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);
        }
        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));
        }
        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)));
        }
        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));
        }
Exemple #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));
 }
        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));
        }
 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));
 }
        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));
        }
        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();
        }
        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;
        }
        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;
        }
        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);
        }
        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);
        }
        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));
        }
        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));
        }
        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);
        }
        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);
        }
        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);
        }