Beispiel #1
0
            public void ThrowsInvalidOperationExceptionIfGuestSystemIsDisabled()
            {
                var settings = new CoreSettings
                {
                    EnableGuestSystem = false,
                    LockRemoteControl = true
                };

                var  accessControl = new AccessControl(settings);
                Guid localToken    = accessControl.RegisterLocalAccessToken();

                accessControl.SetRemotePassword(localToken, "Password");

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws <InvalidOperationException>(() => accessControl.RegisterShadowVote(token, SetupShadowVotedEntry()));
            }
Beispiel #2
0
            public void UpdatesOnlyRemoteAccessPermissions()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl     = true,
                    RemoteControlPassword = null
                };

                var accessControl = new AccessControl(settings);

                Guid localToken = accessControl.RegisterLocalAccessToken();

                Guid remoteToken       = accessControl.RegisterRemoteAccessToken(new Guid());
                var  remotePermissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection();

                accessControl.SetRemotePassword(localToken, "password");

                Assert.Equal(AccessPermission.Admin, accessControl.ObserveAccessPermission(localToken).FirstAsync().Wait());
                Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest }, remotePermissions);
            }
Beispiel #3
0
        public void UpdatesRemoteAccessWhenLockRemoteSettingChanges()
        {
            var settings = new CoreSettings
            {
                LockRemoteControl = false
            };

            var accessControl = new AccessControl(settings);

            Guid remoteToken = accessControl.RegisterRemoteAccessToken(new Guid());
            Guid adminToken  = accessControl.RegisterLocalAccessToken();

            var permissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection();

            settings.LockRemoteControl = true;
            accessControl.SetRemotePassword(adminToken, "password");

            settings.LockRemoteControl = false;
            settings.LockRemoteControl = true;

            Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin, AccessPermission.Guest }, permissions);
        }
Beispiel #4
0
        public void UpdatesRemoteAccessWhenLockRemoteSettingChanges()
        {
            var settings = new CoreSettings
            {
                LockRemoteControl = false
            };

            var accessControl = new AccessControl(settings);

            Guid remoteToken = accessControl.RegisterRemoteAccessToken(new Guid());
            Guid adminToken = accessControl.RegisterLocalAccessToken();

            var permissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection();

            settings.LockRemoteControl = true;
            accessControl.SetRemotePassword(adminToken, "password");

            settings.LockRemoteControl = false;
            settings.LockRemoteControl = true;

            Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin, AccessPermission.Guest }, permissions);
        }
Beispiel #5
0
            public void UpdatesOnlyRemoteAccessPermissions()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl = true,
                    RemoteControlPassword = null
                };

                var accessControl = new AccessControl(settings);

                Guid localToken = accessControl.RegisterLocalAccessToken();

                Guid remoteToken = accessControl.RegisterRemoteAccessToken(new Guid());
                var remotePermissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection();

                accessControl.SetRemotePassword(localToken, "password");

                Assert.Equal(AccessPermission.Admin, accessControl.ObserveAccessPermission(localToken).FirstAsync().Wait());
                Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest }, remotePermissions);
            }
            public void ThrowsInvalidOperationExceptionIfGuestSystemIsDisabled()
            {
                var settings = new CoreSettings
                {
                    EnableGuestSystem = false,
                    LockRemoteControl = true
                };

                var accessControl = new AccessControl(settings);
                Guid localToken = accessControl.RegisterLocalAccessToken();
                accessControl.SetRemotePassword(localToken, "Password");

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws<InvalidOperationException>(() => accessControl.RegisterShadowVote(token, SetupShadowVotedEntry()));
            }