Example #1
0
        public static Folder GetById(int id)
        {
            var factory = new ContentFolderFactory();
            var folder  = factory.CreateRepository().GetById(id);

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

            return(folder);
        }
Example #2
0
        public static ListResult <FolderFile> GetFileList(ListCommand command, int parentFolderId, LibraryFileFilter filter)
        {
            var factory    = new ContentFolderFactory();
            var repository = factory.CreateRepository();
            var folder     = repository.GetById(parentFolderId);

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

            return(folder.GetFiles(command, filter));
        }
Example #3
0
        public static LibraryResult Library(int id, string subFolder)
        {
            if (!ContentRepository.Exists(id))
            {
                throw new Exception(string.Format(ContentStrings.ContentNotFound, id));
            }

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

            return(new LibraryResult {
                Folder = folder
            });
        }
Example #4
0
        private static PathSecurityResult CheckContentFolder(string pathToFind, int contentId)
        {
            var result        = new PathSecurityResult();
            var factory       = new ContentFolderFactory();
            var contentFolder = FindLongest(pathToFind, factory.CreateRepository().GetPaths(contentId));

            if (contentFolder != null)
            {
                result.Result   = SecurityRepository.IsEntityAccessible(EntityTypeCode.ContentFolder, contentFolder.Id, ActionTypeCode.Update);
                result.FolderId = contentFolder.Id;
            }
            else
            {
                result.Result = SecurityRepository.IsEntityAccessible(EntityTypeCode.Content, contentId, ActionTypeCode.Update);
            }

            return(result);
        }