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 FileModel FilterAccessibleFolderAndFiles(String virtualPath, String userName) { FileModel fileModel = null; AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); DocumentsOperations docOps = new DocumentsOperations(); FileModel commonFileModel = new FileModel(UtilityOperations.GetDockerCommonFolderPath(), ""); if (!aNaOps.IsSystemAdministratorUser(userName) && !aNaOps.IsDMSAdministratorUser(userName)) { fileModel = new FileModel(virtualPath, "/" + userName); List <String> dbFilesVPath = docOps.GetFilesByUserName(userName).Select(file => file.VirtualPath).ToList(); if (fileModel.IsRootDir) { fileModel.CommonFolderFiles = commonFileModel.CurrentFolderFiles.Where(file => dbFilesVPath.Contains(file.VirtualPath)).ToList(); } else { fileModel.CommonFolderFiles = new List <FileModel>(); } fileModel.Tags = docOps.GetAllTagsByUserId(aNaOps.GetUserIDByUserName(userName)); } else { fileModel = new FileModel(virtualPath, ""); String[] usersPath = docOps.GetAllUsersFolderInArray(UtilityOperations.GetDockerRootPath() + "/"); foreach (FileModel file in fileModel.CurrentFolderFiles) { if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } } if (fileModel.IsRootDir) { fileModel.CommonFolderFiles = commonFileModel.CurrentFolderFiles; } else { fileModel.CommonFolderFiles = new List <FileModel>(); } fileModel.Tags = docOps.GetAllTagsByUserId(aNaOps.GetUserIDByUserName(userName)); } return(fileModel); }
public ActionResult DeleteUser_Controller(String userName) { DocumentsOperations docOps = new DocumentsOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); docOps.RemoveUsersFilesAuthorizationsByUserName(aNaOps.GetUserIDByUserName(userName)); bool delUserStatus = Membership.DeleteUser(userName, true); return(RedirectToAction("ListUsers")); }
public JsonResult DeleteKeyword(String fileID, String userName, String keyword) { DCEOperations dceOps = new DCEOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); return(new JsonResult() { Data = dceOps.DeleteKeyword(new Guid(fileID), aNaOps.GetUserIDByUserName(userName), keyword.Trim()) }); }
public JsonResult AddKeyword(String fileID, String userName, String keyword, String rank) { DCEOperations dceOps = new DCEOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); return(new JsonResult() { Data = dceOps.InsertKeyword(new Guid(fileID), aNaOps.GetUserIDByUserName(userName), keyword.Trim(), Convert.ToDouble(rank)) }); }
public ActionResult SearchTags(String virtualPath, String tagName) { FileModel fileModel = new FileModel(virtualPath, ""); fileModel.IsRootDir = true; fileModel.IsSearchResult = true; DocumentsOperations docOps = new DocumentsOperations(); AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); String[] usersPath = docOps.GetAllUsersFolderInArray(UtilityOperations.GetDockerRootPath() + "/"); List <FileModel> searchCurrentResult = new List <FileModel>(); List <FileModel> searchCommonResult = new List <FileModel>(); foreach (String vPath in docOps.GetVirtualPathsByTagName(aNaOps.GetUserIDByUserName(HttpContext.User.Identity.Name), tagName)) { FileModel file = null; if (vPath.StartsWith(UtilityOperations.GetDockerCommonFolderPath())) { file = (new FileModel()).GetFolderOrFile(vPath); file.IsCommonFolder = true; if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } searchCommonResult.Add(file); } else { file = (new FileModel()).GetFolderOrFile(vPath); if (usersPath.Contains(file.VirtualPath)) { file.IsUserFolder = true; } searchCurrentResult.Add(file); } } fileModel.CurrentFolderFiles = searchCurrentResult; fileModel.CommonFolderFiles = searchCommonResult; fileModel.Tags = new List <String>(); return(View(fileModel)); }
public JsonResult GetUserActivityReportForASpecificUser(string userName) { List <UserLoginAuditTrailJsonModel> UserLoginAuditTrailViewModeldata = new List <UserLoginAuditTrailJsonModel>(); if (!String.IsNullOrEmpty(userName)) { AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations(); List <UserLoginAuditTrail> userActivityAuditTrails = aNaOps.GetUserActivityAuditTrailsBySpecificUser(aNaOps.GetUserIDByUserName(userName)); foreach (UserLoginAuditTrail item in userActivityAuditTrails) { UserLoginAuditTrailJsonModel userLoginAuditTrailJsonModel = new UserLoginAuditTrailJsonModel(); userLoginAuditTrailJsonModel.UserID = (item.UserID).ToString(); userLoginAuditTrailJsonModel.UserName = item.UserName; userLoginAuditTrailJsonModel.DateTimeLogged = (item.DateTimeLogged).ToString(); UserLoginAuditTrailViewModeldata.Add(userLoginAuditTrailJsonModel); } } return(Json(new { Total = UserLoginAuditTrailViewModeldata.Count, Data = UserLoginAuditTrailViewModeldata })); }