コード例 #1
0
ファイル: SiteService.cs プロジェクト: AuthorProxy/QP
        public static ListResult <FolderFile> GetFileList(ListCommand command, int parentFolderId, LibraryFileFilter filter)
        {
            var factory    = new SiteFolderFactory();
            var repository = factory.CreateRepository();
            var folder     = repository.GetById(parentFolderId);

            if (folder == null)
            {
                throw new Exception(string.Format(LibraryStrings.SiteFolderNotExists, parentFolderId));
            }

            return(folder.GetFiles(command, filter));
        }
コード例 #2
0
ファイル: SiteService.cs プロジェクト: AuthorProxy/QP
        public static LibraryResult Library(int id, string subFolder)
        {
            if (!SiteRepository.Exists(id))
            {
                throw new Exception(string.Format(SiteStrings.SiteNotFound, id));
            }

            var factory    = new SiteFolderFactory();
            var repository = factory.CreateRepository();
            var folder     = repository.GetBySubFolder(id, subFolder);

            return(new LibraryResult {
                Folder = folder
            });
        }
コード例 #3
0
ファイル: PathSecurity.cs プロジェクト: AuthorProxy/QP
        private static PathSecurityResult CheckSiteFolder(string pathToFind, int siteId)
        {
            var result     = new PathSecurityResult();
            var factory    = new SiteFolderFactory();
            var siteFolder = FindLongest(pathToFind, factory.CreateRepository().GetPaths(siteId));

            if (siteFolder != null)
            {
                result.Result   = SecurityRepository.IsEntityAccessible(EntityTypeCode.SiteFolder, siteFolder.Id, ActionTypeCode.Update);
                result.FolderId = siteFolder.Id;
            }
            else
            {
                result.Result = SecurityRepository.IsEntityAccessible(EntityTypeCode.Site, siteId, ActionTypeCode.Update);
            }

            return(result);
        }