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())); }
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 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); }
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); }
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())); }