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 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 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 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 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> 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 <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 ICommandProvider GetProvider(string name) { return(ProxiedServices.FirstOrDefault(c => c.ServiceName.Equals(name, StringComparison.OrdinalIgnoreCase))); }
public bool SupportsUser(IUser user) { return(ProxiedServices.Any(c => c.SupportsUser(user))); }
public IEnumerable <IPermissionGroup> GetGroups(IIdentity target) { return(ProxiedServices.Where(c => c.SupportsTarget(target)) .SelectMany(c => c.GetGroups(target))); }
public bool PluginExists(string name) { return(ProxiedServices.Any(c => c.PluginExists(name))); }
public bool SupportsTarget(IPermissionEntity target) { return(ProxiedServices.Any(c => c.SupportsTarget(target))); }
public async Task <IEnumerable <IPermissionGroup> > GetGroupsAsync() { return(ProxiedServices.SelectMany(c => c.GetGroupsAsync().GetAwaiter().GetResult())); }
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 IEnumerable <IPermissionGroup> GetGroups() { return(ProxiedServices.SelectMany(c => c.GetGroups())); }
public async Task <IEnumerable <IPermissionGroup> > GetGroupsAsync(IPermissionEntity target) { return(ProxiedServices.Where(c => c.SupportsTarget(target)) .SelectMany(c => c.GetGroupsAsync(target).GetAwaiter().GetResult())); }
public void Load(IConfigurationContext context) { ProxiedServices.ForEach(c => c.Load(context)); }
public bool IsEnabled(LogLevel level) { return(ProxiedServices.Any(c => c.IsEnabled(level))); }
public void Reload() { ProxiedServices.ForEach(c => c.Reload()); }
public IEnumerable <string> GetDeniedPermissions(IIdentity target, bool inherit = true) { return(ProxiedServices .Where(c => c.SupportsTarget(target)) .SelectMany(c => c.GetDeniedPermissions(target, inherit))); }
public void Save() { ProxiedServices.ForEach(c => c.Save()); }