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 GetDirectoryItemWithDNNPermissions(string path, bool loadFiles) { var radDirectory = TelerikContent.ResolveDirectory(FileSystemValidation.ToVirtualPath(path)); var directoryArray = new[] { radDirectory }; var returnValues = AddChildDirectoriesToList(ref directoryArray, true, loadFiles); if (returnValues != null && returnValues.Length > 0) { return(returnValues[0]); } return(null); }
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); }