Esempio n. 1
0
        public string GenerateSharedLink(string fileid, FileShare share)
        {
            var file = GetFileInfo(fileid);

            var objectid   = "file_" + file.Id;
            var sharedInfo = _fileStorageService.GetSharedInfo(new Web.Files.Services.WCFService.ItemList <string> {
                objectid
            }).Find(r => r.SubjectId == FileConstant.ShareLinkId);

            if (sharedInfo == null || sharedInfo.Share != share)
            {
                var list = new Web.Files.Services.WCFService.ItemList <AceWrapper>
                {
                    new AceWrapper
                    {
                        SubjectId    = FileConstant.ShareLinkId,
                        SubjectGroup = true,
                        Share        = share
                    }
                };
                var aceCollection = new AceCollection
                {
                    Entries = new Web.Files.Services.WCFService.ItemList <string> {
                        objectid
                    },
                    Aces = list
                };
                _fileStorageService.SetAceObject(aceCollection, false);
                sharedInfo = _fileStorageService.GetSharedInfo(new Web.Files.Services.WCFService.ItemList <string> {
                    objectid
                }).Find(r => r.SubjectId == FileConstant.ShareLinkId);
            }

            return(sharedInfo.SubjectName);
        }
Esempio n. 2
0
        public IEnumerable <FileOperationResult> DeleteBatchItems(IEnumerable <String> folderIds, IEnumerable <String> fileids)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList <String>();

            itemList.AddRange(folderIds.Select(x => "folder_" + x));
            itemList.AddRange(fileids.Select(x => "file_" + x));

            return(_fileStorageService.DeleteItems(itemList));
        }
Esempio n. 3
0
        public IEnumerable <FileOperationResult> CopyBatchItems(String destFolderId, IEnumerable <String> folderIds, IEnumerable <String> fileids, bool overwrite)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList <String>();

            itemList.AddRange(folderIds.Select(x => "folder_" + x));
            itemList.AddRange(fileids.Select(x => "file_" + x));

            return(_fileStorageService.MoveOrCopyItems(itemList, destFolderId, overwrite.ToString(CultureInfo.InvariantCulture), true.ToString(CultureInfo.InvariantCulture)));
        }
Esempio n. 4
0
        public IEnumerable <FileShareWrapper> RemoveFolderSecurityInfo(String folderid, IEnumerable <Guid> shareTo)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList <String> {
                "folder_" + folderid
            };

            _fileStorageService.RemoveAce(itemList);

            return(GetFolderSecurityInfo(folderid));
        }
Esempio n. 5
0
 public IEnumerable <FileShareWrapper> SetFileSecurityInfo(string fileid, IEnumerable <FileShareParams> share, bool notify, string sharingMessage)
 {
     if (share != null && share.Any())
     {
         var list = new Web.Files.Services.WCFService.ItemList <AceWrapper>(share.Select(x => x.ToAceObject()));
         list[0].Message = sharingMessage;
         _fileStorageService.SetAceObject(list,
                                          "file_" + fileid,
                                          notify);
     }
     return(GetFileSecurityInfo(fileid));
 }
Esempio n. 6
0
        public IEnumerable <FileShareWrapper> RemoveFileSecurityInfo(String fileid, IEnumerable <Guid> shareTo)
        {
            //TODO: shareTo

            var itemList = new Web.Files.Services.WCFService.ItemList <String> {
                "file_" + fileid
            };

            _fileStorageService.RemoveAce(itemList);

            return(GetFileSecurityInfo(fileid));
        }
Esempio n. 7
0
 public IEnumerable <FileShareWrapper> SetFileSecurityInfo(string fileid, IEnumerable <FileShareParams> share, bool notify, string sharingMessage)
 {
     if (share != null && share.Any())
     {
         var list          = new Web.Files.Services.WCFService.ItemList <AceWrapper>(share.Select(x => x.ToAceObject()));
         var aceCollection = new AceCollection
         {
             Entries = new Web.Files.Services.WCFService.ItemList <string> {
                 "file_" + fileid
             },
             Aces    = list,
             Message = sharingMessage
         };
         _fileStorageService.SetAceObject(aceCollection, notify);
     }
     return(GetFileSecurityInfo(fileid));
 }
Esempio n. 8
0
        public IEnumerable<FileOperationWraper> CopyBatchItems(String destFolderId, IEnumerable<String> folderIds, IEnumerable<String> fileIds, FileConflictResolveType conflictResolveType)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList<String>();

            itemList.AddRange((folderIds ?? new List<String>()).Select(x => "folder_" + x));
            itemList.AddRange((fileIds ?? new List<String>()).Select(x => "file_" + x));

            return _fileStorageService.MoveOrCopyItems(itemList, destFolderId, conflictResolveType, true).Select(o => new FileOperationWraper(o));
        }
Esempio n. 9
0
        public IEnumerable<FileWrapper> MoveOrCopyBatchCheck(String destFolderId, IEnumerable<String> folderIds, IEnumerable<String> fileIds)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList<String>();

            itemList.AddRange((folderIds ?? new List<String>()).Select(x => "folder_" + x));
            itemList.AddRange((fileIds ?? new List<String>()).Select(x => "file_" + x));

            var ids = _fileStorageService.MoveOrCopyFilesCheck(itemList, destFolderId).Keys.Select(id => "file_" + id);

            var entries = _fileStorageService.GetItems(new Web.Files.Services.WCFService.ItemList<string>(ids), FilterType.FilesOnly, "", "");
            return entries.Select(x => new FileWrapper((Files.Core.File)x)).ToSmartList();
        }
Esempio n. 10
0
        public string GenerateSharedLink(string fileid, FileShare share)
        {
            var file = GetFileInfo(fileid);

            var objectid = "file_" + file.Id;
            var sharedInfo = _fileStorageService.GetSharedInfo(new Web.Files.Services.WCFService.ItemList<string> { objectid }).Find(r => r.SubjectId == FileConstant.ShareLinkId);
            if (sharedInfo == null || sharedInfo.Share != share)
            {
                var list = new Web.Files.Services.WCFService.ItemList<AceWrapper>
                    {
                        new AceWrapper
                            {
                                SubjectId = FileConstant.ShareLinkId,
                                SubjectGroup = true,
                                Share = share
                            }
                    };
                var aceCollection = new AceCollection
                    {
                        Entries = new Web.Files.Services.WCFService.ItemList<string> { objectid },
                        Aces = list
                    };
                _fileStorageService.SetAceObject(aceCollection, false);
                sharedInfo = _fileStorageService.GetSharedInfo(new Web.Files.Services.WCFService.ItemList<string> { objectid }).Find(r => r.SubjectId == FileConstant.ShareLinkId);
            }

            return sharedInfo.SubjectName;
        }
Esempio n. 11
0
        public bool RemoveSecurityInfo(IEnumerable<String> folderIds, IEnumerable<String> fileIds)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList<String>();

            itemList.AddRange((folderIds ?? new List<String>()).Select(x => "folder_" + x));
            itemList.AddRange((fileIds ?? new List<String>()).Select(x => "file_" + x));

            _fileStorageService.RemoveAce(itemList);

            return true;
        }
Esempio n. 12
0
        public IEnumerable<FileShareWrapper> RemoveFolderSecurityInfo(String folderid, IEnumerable<Guid> shareTo)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList<String> { "folder_" + folderid };

            _fileStorageService.RemoveAce(itemList);

            return GetFolderSecurityInfo(folderid);
        }
Esempio n. 13
0
        public IEnumerable<FileShareWrapper> RemoveFileSecurityInfo(String fileid, IEnumerable<Guid> shareTo)
        {
            //TODO: shareTo

            var itemList = new Web.Files.Services.WCFService.ItemList<String> { "file_" + fileid };

            _fileStorageService.RemoveAce(itemList);

            return GetFileSecurityInfo(fileid);
        }
Esempio n. 14
0
        public IEnumerable<FileOperationResult> CopyBatchItems(String destFolderId, IEnumerable<String> folderIds, IEnumerable<String> fileids, bool overwrite)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList<String>();

            itemList.AddRange(folderIds.Select(x => "folder_" + x));
            itemList.AddRange(fileids.Select(x => "file_" + x));

            return _fileStorageService.MoveOrCopyItems(itemList, destFolderId, overwrite.ToString(CultureInfo.InvariantCulture), true.ToString(CultureInfo.InvariantCulture));
        }
Esempio n. 15
0
        public IEnumerable<FileOperationWraper> DeleteBatchItems(IEnumerable<String> folderIds, IEnumerable<String> fileIds)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList<String>();

            itemList.AddRange((folderIds ?? new List<String>()).Select(x => "folder_" + x));
            itemList.AddRange((fileIds ?? new List<String>()).Select(x => "file_" + x));

            return _fileStorageService.DeleteItems("delete", itemList).Select(o => new FileOperationWraper(o));
        }
Esempio n. 16
0
        public IEnumerable<FileOperationResult> DeleteBatchItems(IEnumerable<String> folderIds, IEnumerable<String> fileids)
        {
            var itemList = new Web.Files.Services.WCFService.ItemList<String>();

            itemList.AddRange(folderIds.Select(x => "folder_" + x));
            itemList.AddRange(fileids.Select(x => "file_" + x));

            return _fileStorageService.DeleteItems(itemList);
        }
Esempio n. 17
0
        public IEnumerable<FileShareWrapper> SetFolderSecurityInfo(string folderid, IEnumerable<FileShareParams> share, bool notify, string sharingMessage)
        {
            if (share != null && share.Any())
            {
                var list = new Web.Files.Services.WCFService.ItemList<AceWrapper>(share.Select(x => x.ToAceObject()));
                var aceCollection = new AceCollection
                    {
                        Entries = new Web.Files.Services.WCFService.ItemList<string> { "folder_" + folderid },
                        Aces = list,
                        Message = sharingMessage
                    };
                _fileStorageService.SetAceObject(aceCollection, notify);
            }

            return GetFolderSecurityInfo(folderid);
        }
Esempio n. 18
0
        public IEnumerable<FileShareWrapper> SetFolderSecurityInfo(string folderid, IEnumerable<FileShareParams> share, bool notify, string sharingMessage)
        {
            if (share != null && share.Any())
            {
                var list = new Web.Files.Services.WCFService.ItemList<AceWrapper>(share.Select(x => x.ToAceObject()));
                list[0].Message = sharingMessage;
                _fileStorageService.SetAceObject(list,
                                                 "folder_" + folderid,
                                                 notify);
            }

            return GetFolderSecurityInfo(folderid);
        }