public IEnumerable <string> AnonymousPermissions() { var result = new List <string>(); var count = 0; using (_databaseContextFactory.Create(_configuration.ProviderName, _configuration.ConnectionString)) { count = _systemUserQuery.Count(); result.AddRange(_systemRoleQuery.Permissions("Anonymous")); } if (count == 0) { result.Add(SystemPermissions.Manage.Users); result.Add(SystemPermissions.Register.UserRequired); } return(result); }
public IEnumerable <string> AnonymousPermissions() { int count; var result = new List <string>(); using (_databaseContextFactory.Create()) { count = _systemUserQuery.Count(); } result.AddRange(_systemRoleQuery.Permissions("Anonymous")); if (count == 0) { result.Add(SystemPermissions.States.UserRequired); result.Add(SystemPermissions.Register.User); } return(result); }
public IActionResult PermissionStatus([FromBody] RolePermissionStatusModel model) { Guard.AgainstNull(model, nameof(model)); List <string> permissions; using (_databaseContextFactory.Create()) { permissions = _systemRoleQuery.Permissions(model.RoleId).ToList(); } return(Ok( new { Data = from permission in model.Permissions select new { Permission = permission, Active = permissions.Find(item => item.Equals(permission)) != null } })); }