public Task <bool> AddRoleToActorAsync(IPermissionActor actor, string roleId) { if (actor == null) { throw new ArgumentNullException(nameof(actor)); } if (string.IsNullOrEmpty(roleId)) { throw new ArgumentException(nameof(roleId)); } if (RocketModIntegrationEnabled() && IsRocketModRole(roleId)) { if (!IsPlayerActor(actor.Type)) { throw new NotSupportedException($"Cannot add non-player actor {actor.Type} to a RocketMod group."); } var result = R.Permissions.AddPlayerToGroup(roleId, ToRocketPlayer(actor)); return(Task.FromResult(result == RocketPermissionsProviderResult.Success)); } return(m_BasePermissionRoleStore.AddRoleToActorAsync(actor, roleId)); }
public async Task <bool> AddRoleToActorAsync(IPermissionActor actor, string roleId) { if (IsRocketModRole(roleId)) { throw new System.NotSupportedException(); } return(await m_BasePermissionRoleStore.AddRoleToActorAsync(actor, roleId)); }
protected override async Task ExecuteUpdateAsync(IPermissionActor target, IPermissionRole permissionRole) { if (await m_PermissionRoleStore.AddRoleToActorAsync(target, permissionRole.Id)) { await Context.Actor.PrintMessageAsync($"Added \"{target.DisplayName}\" to \"{permissionRole.DisplayName}\".", Color.DarkGreen); } else { await Context.Actor.PrintMessageAsync($"Failed to add \"{target.DisplayName}\" to \"{permissionRole.DisplayName}\".", Color.DarkRed); } }
public RocketPermissionsProviderResult AddPlayerToGroup(string groupId, IRocketPlayer player) { var actor = ConvertToActor(player); return(AsyncHelper.RunSync(async() => { if (await m_PermissionRoleStore.AddRoleToActorAsync(actor, groupId)) { return RocketPermissionsProviderResult.Success; } return RocketPermissionsProviderResult.UnspecifiedError; })); }
public RocketPermissionsProviderResult AddPlayerToGroup(string groupId, IRocketPlayer player) { if (player == null) { throw new ArgumentNullException(nameof(player)); } if (string.IsNullOrEmpty(groupId)) { throw new ArgumentException(nameof(groupId)); } var actor = ConvertToActor(player); return(AsyncHelper.RunSync(async() => { if (await m_PermissionRoleStore.AddRoleToActorAsync(actor, groupId)) { return RocketPermissionsProviderResult.Success; } return RocketPermissionsProviderResult.UnspecifiedError; })); }