public List <Models.Permissions> GetAllDatabasePermissions(string DomainOrServerName, string UserName, string Password, int DatabaseID, bool domain = true) { List <Models.Permissions> permissions = new List <Models.Permissions>(); try { var logic = new Square9.SecurityDisplay.Logic.UsersLogic(); permissions = logic.GetAllDatabasePermissions(DomainOrServerName, UserName, Password, DatabaseID, domain); } catch (Exception) { throw; } return(permissions); }
public HttpResponseMessage GetAllDatabasePermissions(int DatabaseID, bool isDomain = true) { List <Models.Permissions> permissions = new List <Models.Permissions>(); IEnumerable <string> headerValues; var authHeader = string.Empty; if (Request.Headers.TryGetValues("Authorization", out headerValues)) { authHeader = headerValues.FirstOrDefault(); } try { var logic = new Square9.SecurityDisplay.Logic.UsersLogic(); var authData = logic.GetAuthValues(authHeader); permissions = logic.GetAllDatabasePermissions(authData.Domain, authData.Username, authData.Password, DatabaseID, isDomain); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.Forbidden, "Unable to return permissions: " + ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, permissions)); }