SWIFolder getFolder(string path) { checkSWIAuthentication(); path = FileHelper.ConvertOSFilePath(path); if (string.IsNullOrEmpty(path)) { throw new Exception("Error: path must be supplied"); } if (path.Contains(".." + Path.DirectorySeparatorChar.ToString())) { throw new Exception("Error: invalid path"); } SWIFolder result = new SWIFolder(); result.path = path; result.right = 0; result.sql = WebUser.SqlModel; result.SetFullPath(getFullPath(path)); if (result.IsPersonal) { //Personal if (WebUser.PersonalFolderRight == PersonalFolderRight.None) { throw new Exception("Error: this user has no personal folder"); } result.SetManageFlag(true, true, result.FinalPath == ""); result.expand = false; string prefix = Repository.GetPersonalFolderName(WebUser); result.name = (result.FinalPath == "" ? prefix : Path.GetFileName(result.FinalPath)); result.fullname = prefix + (result.FinalPath == "" ? Path.DirectorySeparatorChar.ToString() : "") + result.FinalPath; result.right = (int)FolderRight.Edit; result.files = (WebUser.PersonalFolderRight == PersonalFolderRight.Files); } else { result.name = (result.FinalPath == Path.DirectorySeparatorChar.ToString() ? Translate("Reports") : Repository.TranslateFolderName(path)); result.fullname = Translate("Reports") + Repository.TranslateFolderPath(result.FinalPath); SecurityFolder securityFolder = WebUser.FindSecurityFolder(path); if (securityFolder != null) { result.SetManageFlag(securityFolder.UseSubFolders, securityFolder.ManageFolder, securityFolder.IsDefined); result.expand = securityFolder.ExpandSubFolders; result.right = (int)securityFolder.FolderRight; result.files = securityFolder.FilesOnly; } } return(result); }
SWIFolder getFolder(string path) { checkSWIAuthentication(); if (string.IsNullOrEmpty(path)) { throw new Exception("Error: path must be supplied"); } if (path.Contains("..\\")) { throw new Exception("Error: invalid path"); } SWIFolder result = new SWIFolder(); result.path = path; result.right = 0; result.SetFullPath(getFullPath(path)); if (result.IsPersonal) { //Personal if (!WebUser.HasPersonalFolder) { throw new Exception("Error: this user has no personal folder"); } result.SetManageFlag(true, true, result.Path == ""); result.expand = false; string prefix = Repository.GetPersonalFolderName(WebUser); result.name = (result.Path == "" ? prefix : Path.GetFileName(result.Path)); result.fullname = prefix + (result.Path == "" ? "\\" : "") + result.Path; result.right = (int)FolderRight.Edit; } else { result.name = (result.Path == "\\" ? Repository.TranslateWeb("Reports") : Repository.TranslateFolderName(path)); result.fullname = Repository.TranslateWeb("Reports") + Repository.TranslateFolderPath(result.Path); SecurityFolder securityFolder = WebUser.FindSecurityFolder(path); if (securityFolder != null) { result.SetManageFlag(securityFolder.UseSubFolders, securityFolder.ManageFolder, securityFolder.IsDefined); result.expand = securityFolder.ExpandSubFolders; result.right = (int)securityFolder.FolderRight; } } return(result); }