public IActionResult save(string userID, string permissionsJson, string rolesJson) { var permissions = JsonConvert.DeserializeObject <List <Permission> >(permissionsJson); var roles = JsonConvert.DeserializeObject <List <Role> >(rolesJson); int i = new DataManager(userID).SaveUser(userID, permissions, roles); AuthorizationController.Result result = new AuthorizationController.Result(); result.StatusName = ((ErrorCodes)i).ToString(); result.StatusCode = i; return(new JsonResult(result)); }
public IActionResult AddKey(string name, string userId = null) { if (string.IsNullOrEmpty(userId)) { userId = User.FindFirstValue(ClaimTypes.NameIdentifier); } int i = new DataManager(userId).AddKey(name, userId); AuthorizationController.Result result = new AuthorizationController.Result(); result.StatusName = ((ErrorCodes)i).ToString(); result.StatusCode = i; return(new JsonResult(result)); }
public IActionResult AddRole(string values) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var d = JsonConvert.DeserializeObject <RoleResult>(values); int i = new DataManager(userId).AddRole(d.Name); AuthorizationController.Result result = new AuthorizationController.Result(); result.StatusName = ((ErrorCodes)i).ToString(); result.StatusCode = i; return(new JsonResult(result)); }
public IActionResult deleteCat(long autokey, string userId = null) { if (string.IsNullOrEmpty(userId)) { userId = User.FindFirstValue(ClaimTypes.NameIdentifier); } int i = new DataManager(userId).DeleteCategory(autokey); AuthorizationController.Result result = new AuthorizationController.Result(); result.StatusName = ((ErrorCodes)i).ToString(); result.StatusCode = i; return(new JsonResult(result)); }
public IActionResult saveRole(string roleID, string permissionsJson, string userId = null) { if (string.IsNullOrEmpty(userId)) { userId = User.FindFirstValue(ClaimTypes.NameIdentifier); } var permissions = JsonConvert.DeserializeObject <List <Permission> >(permissionsJson); int i = new DataManager(userId).SaveRole(roleID, permissions); AuthorizationController.Result result = new AuthorizationController.Result(); result.StatusName = ((ErrorCodes)i).ToString(); result.StatusCode = i; return(new JsonResult(result)); }
public IActionResult UpdateRole(int key, string values, string userId = null) { // Update if (string.IsNullOrEmpty(userId)) { userId = User.FindFirstValue(ClaimTypes.NameIdentifier); } var d = JsonConvert.DeserializeObject <RoleResult>(values); int i = new DataManager(userId).UpdateRole(key, d.Name); AuthorizationController.Result result = new AuthorizationController.Result(); result.StatusName = ((ErrorCodes)i).ToString(); result.StatusCode = i; return(new JsonResult(result)); }