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 })); }
private static void AssignAccessToFileOrFolder(string userID, string path) { DocumentsOperations documentsOperations = new DocumentsOperations(); string virtualPath = UtilityOperations.GetVirtualPath(path); Guid fileID = documentsOperations.GetFileIDByVirtualPath(virtualPath); documentsOperations.InsertUsersFilesAuthorizations(new Guid(userID), fileID); }