public ActionResult EditCommonFolder(CommonFolderAssignment cfa, String submit, String editCommonFolderKey, String editCommonFolderVal) { DocumentsOperations docOps = new DocumentsOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); switch (submit) { case "Add": if (String.Equals(editCommonFolderKey.ToUpper(), "USER")) { docOps.InsertUsersFilesAuthorizations(aNaOps.GetUserIDByUserName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath)); } else if (String.Equals(editCommonFolderKey.ToUpper(), "ROLE")) { docOps.InsertRolesFilesAuthorizations(aNaOps.GetRoleIDByRoleName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath)); } break; case "Remove": if (String.Equals(editCommonFolderKey.ToUpper(), "USER")) { docOps.RemoveUsersFilesAuthorizations(aNaOps.GetUserIDByUserName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath)); } else if (String.Equals(editCommonFolderKey.ToUpper(), "ROLE")) { docOps.RemoveRolesFilesAuthorizations(aNaOps.GetRoleIDByRoleName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath)); } break; } return(RedirectToAction("EditCommonFolder", new { virtualPath = cfa.VirtualPath })); }
public ActionResult DeleteRole(String roleName) { String[] usersInRole = Roles.GetUsersInRole(roleName); if (usersInRole.Count() > 0) { Roles.RemoveUsersFromRole(usersInRole, roleName); } DocumentsOperations docOps = new DocumentsOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); docOps.RemoveRolesFilesAuthorizationsByRoleID(aNaOps.GetRoleIDByRoleName(roleName)); var delRoleStatus = Roles.DeleteRole(roleName, false); return(RedirectToAction("ListRoles")); }