public bool HandleCommand(IUser user, string commandLine, string prefix) { GuardUser(user); foreach (ICommandHandler handler in ProxiedServices.Where(c => c.SupportsUser(user.GetType()))) { if (handler.HandleCommand(user, commandLine, prefix)) { return(true); } } return(false); }
public async Task <bool> HandleCommandAsync(IUser user, string commandLine, string prefix) { GuardUser(user); foreach (ICommandHandler handler in ProxiedServices.Where(c => c.SupportsUser(user))) { if (await handler.HandleCommandAsync(user, commandLine, prefix)) { return(true); } } return(false); }
public async Task <IPermissionGroup> GetPrimaryGroupAsync(IPermissionEntity user) { IPermissionGroup group; foreach (IPermissionProvider service in ProxiedServices.Where(c => c.SupportsTarget(user))) { if ((group = await service.GetPrimaryGroupAsync(user)) != null) { return(group); } } return(null); }
public IPermissionGroup GetPrimaryGroup(IUser user) { IPermissionGroup group; foreach (IPermissionProvider service in ProxiedServices.Where(c => c.SupportsTarget(user))) { if ((group = service.GetPrimaryGroup(user)) != null) { return(group); } } return(null); }
public PermissionResult CheckHasAnyPermission(IIdentity target, params string[] permissions) { GuardTarget(target); foreach (IPermissionProvider provider in ProxiedServices.Where(c => c.SupportsTarget(target))) { PermissionResult result = provider.CheckHasAnyPermission(target, permissions); if (result == PermissionResult.Default) { continue; } return(result); } return(PermissionResult.Default); }
public async Task <PermissionResult> CheckHasAllPermissionsAsync(IPermissionEntity target, params string[] permissions) { GuardTarget(target); foreach (IPermissionProvider provider in ProxiedServices.Where(c => c.SupportsTarget(target))) { PermissionResult result = await provider.CheckHasAllPermissionsAsync(target, permissions); if (result == PermissionResult.Default) { continue; } return(result); } return(PermissionResult.Default); }
public async Task <PermissionResult> CheckPermissionAsync(IPermissionActor target, string permission) { GuardTarget(target); foreach (IPermissionChecker provider in ProxiedServices.Where(c => c.SupportsTarget(target))) { PermissionResult result = await provider.CheckPermissionAsync(target, permission); if (result == PermissionResult.Default) { continue; } return(result); } return(PermissionResult.Default); }
public async Task <IEnumerable <string> > GetDeniedPermissionsAsync(IPermissionEntity target, bool inherit = true) { return(ProxiedServices .Where(c => c.SupportsTarget(target)) .SelectMany(c => c.GetDeniedPermissionsAsync(target, inherit).GetAwaiter().GetResult())); }
public async Task <IEnumerable <IPermissionGroup> > GetGroupsAsync(IPermissionEntity target) { return(ProxiedServices.Where(c => c.SupportsTarget(target)) .SelectMany(c => c.GetGroupsAsync(target).GetAwaiter().GetResult())); }
public IEnumerable <string> GetDeniedPermissions(IIdentity target, bool inherit = true) { return(ProxiedServices .Where(c => c.SupportsTarget(target)) .SelectMany(c => c.GetDeniedPermissions(target, inherit))); }
public IEnumerable <IPermissionGroup> GetGroups(IIdentity target) { return(ProxiedServices.Where(c => c.SupportsTarget(target)) .SelectMany(c => c.GetGroups(target))); }