private DirectoryItem GetDirectoryItemWithDNNPermissions(string path) { var radDirectory = TelerikContent.ResolveDirectory(FileSystemValidation.ToVirtualPath(path)); if (radDirectory.FullPath == PortalSettings.HomeDirectory) { radDirectory.Name = DNNValidator.GetString("Root"); } Logger.DebugFormat("GetDirectoryItemWithDNNPermissions - path: {0}, radDirectory: {1}", path, radDirectory); //var directoryArray = new[] {radDirectory}; return(AddChildDirectoriesToList(radDirectory)); }
private DirectoryItem AddChildDirectoriesToList(DirectoryItem radDirectory) { var parentFolderPath = radDirectory.FullPath.EndsWith("/") ? radDirectory.FullPath : radDirectory.FullPath + "/"; if (parentFolderPath.StartsWith(PortalSettings.HomeDirectory)) { parentFolderPath = parentFolderPath.Remove(0, PortalSettings.HomeDirectory.Length); } var dnnParentFolder = FolderManager.Instance.GetFolder(PortalSettings.PortalId, parentFolderPath); if (!DNNValidator.CanViewFilesInFolder(dnnParentFolder.FolderPath)) { return(null); } var dnnChildFolders = FolderManager.Instance.GetFolders(dnnParentFolder).Where(folder => (FileSystemValidation.HasPermission(folder, "BROWSE,READ"))); var radDirectories = new List <DirectoryItem>(); foreach (var dnnChildFolder in dnnChildFolders) { if (!dnnChildFolder.FolderPath.ToLowerInvariant().StartsWith("cache/") && !dnnChildFolder.FolderPath.ToLowerInvariant().StartsWith("users/") && !dnnChildFolder.FolderPath.ToLowerInvariant().StartsWith("groups/")) { var radSubDirectory = TelerikContent.ResolveDirectory(FileSystemValidation.ToVirtualPath(dnnChildFolder.FolderPath)); radSubDirectory.Permissions = FileSystemValidation.TelerikPermissions(dnnChildFolder); radDirectories.Add(radSubDirectory); } } radDirectory.Files = IncludeFilesForCurrentFolder(dnnParentFolder); if (parentFolderPath == "") { var userFolder = FolderManager.Instance.GetUserFolder(PortalSettings.UserInfo); if (userFolder.PortalID == PortalSettings.PortalId) { var radUserFolder = TelerikContent.ResolveDirectory(FileSystemValidation.ToVirtualPath(userFolder.FolderPath)); radUserFolder.Name = DNNValidator.GetString("MyFolder"); radUserFolder.Permissions = FileSystemValidation.TelerikPermissions(userFolder); radDirectories.Add(radUserFolder); } } radDirectory.Directories = radDirectories.ToArray(); return(radDirectory); }
private string GetTelerikMessage(string key) { string returnValue = key; switch (key) { case "DirectoryAlreadyExists": returnValue = DNNValidator.GetString("ErrorCodes.DirectoryAlreadyExists"); break; case "InvalidCharactersInPath": returnValue = DNNValidator.GetString("ErrorCodes.InvalidCharactersInPath"); break; case "NewFileAlreadyExists": returnValue = DNNValidator.GetString("ErrorCodes.NewFileAlreadyExists"); break; //Case "" // Exit Select } return(returnValue); }