Inheritance: Seal.Model.RootEditor
        public SecurityFolder FindSecurityFolder(List <SecurityGroup> groups, string folder)
        {
            SecurityFolder result = null;

            foreach (var group in groups)
            {
                string folderRoot = Repository.ConvertToRepositoryPath(folder);
                while (result == null && !string.IsNullOrEmpty(folderRoot))
                {
                    result     = group.Folders.FirstOrDefault(i => i.Path == folderRoot);
                    folderRoot = Path.GetDirectoryName(folderRoot);
                }
                if (result != null && result.Path != Repository.ConvertToRepositoryPath(folder) && !result.UseSubFolders)
                {
                    //cannot use this parent
                    result = null;
                }

                if (result != null)
                {
                    break;
                }
            }
            return(result);
        }
        public SecurityFolder FindSecurityFolder(List <SecurityGroup> groups, string folder)
        {
            SecurityFolder result = null;

            foreach (var group in groups)
            {
                string         folderRoot = folder;
                SecurityFolder current    = null;
                while (current == null && !string.IsNullOrEmpty(folderRoot))
                {
                    current    = group.Folders.FirstOrDefault(i => i.Path == folderRoot);
                    folderRoot = Path.GetDirectoryName(folderRoot);
                }
                if (current != null && current.Path != folder && !current.UseSubFolders)
                {
                    //cannot use this parent
                    current = null;
                }

                if (current != null)
                {
                    if (result != null)
                    {
                        //Merge the groupFolder find in this group with the current result
                        //Weakest right is applied..
                        result.FolderRight      = (FolderRight)Math.Min((int)result.FolderRight, (int)current.FolderRight);
                        result.ExpandSubFolders = result.ExpandSubFolders || current.ExpandSubFolders;
                        result.ManageFolder     = result.ManageFolder && current.ManageFolder;
                    }
                    else
                    {
                        result = (SecurityFolder)Helper.Clone(current);
                    }

                    //set IsDefined flag
                    if (current.Path == folder)
                    {
                        result.IsDefined = true;
                    }
                }
            }
            return(result);
        }
        string getSecuritySummary(SecurityGroup group, string folder)
        {
            StringBuilder        result = new StringBuilder();
            List <SecurityGroup> groups = new List <SecurityGroup>();

            groups.Add(group);
            SecurityFolder securityFolder = FindSecurityFolder(groups, folder);

            if (securityFolder != null)
            {
                string pattern = string.IsNullOrEmpty(securityFolder.SearchPattern) ? "" : string.Format(", Search Pattern:{0}", securityFolder.SearchPattern);
                result.AppendLine(string.Format("    Folder:{0} (Type:{1}{2})\r\n", Repository.ConvertToRepositoryPath(folder), Helper.GetEnumDescription(securityFolder.PublicationType.GetType(), securityFolder.PublicationType), pattern));
            }
            foreach (string subFolder in Directory.GetDirectories(folder))
            {
                result.Append(getSecuritySummary(group, subFolder));
            }
            return(result.ToString());
        }
        string getSecuritySummary(SecurityGroup group, string folder)
        {
            StringBuilder        result = new StringBuilder();
            List <SecurityGroup> groups = new List <SecurityGroup>();

            groups.Add(group);
            string         folder2        = folder.Substring(Repository.ReportsFolder.Length);
            SecurityFolder securityFolder = FindSecurityFolder(groups, folder2);

            if (securityFolder != null)
            {
                result.AppendLine(string.Format("    Folder:'{0}' => Right:{1}; Use Sub-folders:{2}; Manage Sub-folders:{3}; Files Only:{4}\r\n", folder2, Helper.GetEnumDescription(securityFolder.FolderRight.GetType(), securityFolder.FolderRight), securityFolder.UseSubFolders ? "Yes" : "No", securityFolder.UseSubFolders && securityFolder.ManageFolder ? "Yes" : "No", securityFolder.FilesOnly ? "Yes" : "No"));
            }

            foreach (string subFolder in Directory.GetDirectories(folder))
            {
                result.Append(getSecuritySummary(group, subFolder));
            }
            return(result.ToString());
        }