public bool IsGranted(AuthRole role, string resource) { Ensure.ArgumentNotEmpty(role, nameof(role)); Ensure.ArgumentNotEmpty(resource, nameof(resource)); return(role.Permissoins.ContainsKey(resource) ? true : false); }
public bool IsGranted(AuthRole role, string resource, string action) { Ensure.ArgumentNotEmpty(role, nameof(role)); Ensure.ArgumentNotEmpty(resource, nameof(resource)); Ensure.ArgumentNotEmpty(action, nameof(action)); if (role.Permissoins.TryGetValue(resource, out ICollection <string> actions)) { if (actions == null || actions.Contains(action)) { return(true); } } return(false); }
public void SaveRole(AuthRole role) { Ensure.ArgumentNotEmpty(role, nameof(role)); _repo.UpsertRole(role); }