public void ToggleMuteNotConnected() { Assert.DoesNotThrow(() => manager.ToggleMute(user)); Assert.IsNull(manager.GetConnection(user)); }
public static void Disconnect(this IServerUserManager self, IUserInfo user) { if (self == null) { throw new ArgumentNullException("self"); } var c = self.GetConnection(user); if (c != null) { self.Disconnect(c); } }
internal void OnSetPermissionsMessage(MessageEventArgs <SetPermissionsMessage> e) { var msg = e.Message; if (!e.Connection.IsConnected || !context.PermissionsProvider.UpdatedSupported) { return; } if (!context.GetPermission(PermissionName.ModifyPermissions, e.Connection)) { e.Connection.SendAsync(new PermissionDeniedMessage(GablarskiMessageType.SetPermissions)); return; } var perms = msg.Permissions.ToList(); if (perms.Count == 0) { return; } context.PermissionsProvider.SetPermissions(msg.UserId, perms); IUserInfo target = Manager[msg.UserId]; if (target == null) { return; } IConnection c = Manager.GetConnection(target); if (c != null) { c.SendAsync(new PermissionsMessage(msg.UserId, context.PermissionsProvider.GetPermissions(msg.UserId))); } }