コード例 #1
0
            public void ThrowsArgumentExceptionIfGuidIsGarbage()
            {
                var settings = new CoreSettings {
                    LockRemoteControl = false
                };

                var accessControl = new AccessControl(settings);

                Assert.Throws <ArgumentException>(() => accessControl.ObserveAccessPermission(new Guid()));
            }
コード例 #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);
            }
コード例 #3
0
            public void SmokeTest()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl = false
                };

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

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

                accessControl.SetLocalPassword(token, "password");
                accessControl.DowngradeLocalAccess(token);
                accessControl.UpgradeLocalAccess(token, "password");

                Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin }, permissions);
            }
コード例 #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);
        }
コード例 #5
0
ファイル: AccessControlTest.cs プロジェクト: hur1can3/Espera
        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);
        }
コード例 #6
0
ファイル: AccessControlTest.cs プロジェクト: hur1can3/Espera
            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);
            }
コード例 #7
0
ファイル: AccessControlTest.cs プロジェクト: hur1can3/Espera
            public void ThrowsArgumentExceptionIfGuidIsGarbage()
            {
                var settings = new CoreSettings { LockRemoteControl = false };

                var accessControl = new AccessControl(settings);

                Assert.Throws<ArgumentException>(() => accessControl.ObserveAccessPermission(new Guid()));
            }
コード例 #8
0
ファイル: AccessControlTest.cs プロジェクト: hur1can3/Espera
            public void SmokeTest()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl = false
                };

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

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

                accessControl.SetLocalPassword(token, "password");
                accessControl.DowngradeLocalAccess(token);
                accessControl.UpgradeLocalAccess(token, "password");

                Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin }, permissions);
            }