public IEnumerable <FileShareRecord> GetShares(IEnumerable <FileEntry <string> > entries) { var result = new List <FileShareRecord>(); var files = entries.Where(x => x.FileEntryType == FileEntryType.File).ToArray(); var folders = entries.Where(x => x.FileEntryType == FileEntryType.Folder).ToList(); if (files.Any()) { var folderIds = files.Select(x => ((File <string>)x).FolderID).Distinct(); foreach (var folderId in folderIds) { GetFoldersForShare(folderId, folders); } var pureShareRecords = SecurityDao.GetPureShareRecords(files); if (pureShareRecords != null) { foreach (var pureShareRecord in pureShareRecords) { if (pureShareRecord == null) { continue; } pureShareRecord.Level = -1; result.Add(pureShareRecord); } } } result.AddRange(GetShareForFolders(folders)); return(result); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (Disable) return; var isInvalid = false; var account = new AccountInfo(); var dao = new SecurityDao(); if (String.IsNullOrEmpty(account.GetUserName())) isInvalid = true; if (!isInvalid) { var errorMessage = ""; if (!dao.ValidLdapUser(account.GetUserName(), out errorMessage)) isInvalid = true; } if (isInvalid) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Account", action = "Login", ReturnUrl = filterContext.HttpContext.Request.Url.PathAndQuery })); return; } base.OnActionExecuting(filterContext); }
public ProviderTagDao( IServiceProvider serviceProvider, TenantManager tenantManager, SecurityDao <string> securityDao, TagDao <string> tagDao, CrossDao crossDao) : base(serviceProvider, tenantManager, securityDao, tagDao, crossDao) { }
protected void SetSharedProperty(IEnumerable <FileEntry <string> > entries) { SecurityDao.GetPureShareRecords(entries.ToArray()) //.Where(x => x.Owner == SecurityContext.CurrentAccount.ID) .Select(x => x.EntryId).Distinct().ToList() .ForEach(id => { var firstEntry = entries.FirstOrDefault(y => y.ID.Equals(id)); if (firstEntry != null) { firstEntry.Shared = true; } }); }
public IEnumerable <FileShareRecord> GetShares(FileEntry <string> entry) { var result = new List <FileShareRecord>(); if (entry == null) { return(result); } var folders = new List <FileEntry <string> >(); if (entry is Folder <string> entryFolder) { folders.Add(entryFolder); } if (entry is File <string> file) { GetFoldersForShare(file.FolderID, folders); var pureShareRecords = SecurityDao.GetPureShareRecords(entry); if (pureShareRecords != null) { foreach (var pureShareRecord in pureShareRecords) { if (pureShareRecord == null) { continue; } pureShareRecord.Level = -1; result.Add(pureShareRecord); } } } result.AddRange(GetShareForFolders(folders)); return(result); }
public ProviderDaoBase( IServiceProvider serviceProvider, TenantManager tenantManager, SecurityDao <string> securityDao, TagDao <string> tagDao, CrossDao crossDao) { ServiceProvider = serviceProvider; SecurityDao = securityDao; TagDao = tagDao; CrossDao = crossDao; TenantID = tenantManager.GetCurrentTenant().TenantId; Selectors = new List <IDaoSelector> { //Fill in selectors ServiceProvider.GetService <SharpBoxDaoSelector>(), ServiceProvider.GetService <SharePointDaoSelector>(), ServiceProvider.GetService <GoogleDriveDaoSelector>(), ServiceProvider.GetService <BoxDaoSelector>(), ServiceProvider.GetService <DropboxDaoSelector>(), ServiceProvider.GetService <OneDriveDaoSelector>() }; }
public void SetShare(FileShareRecord r) { SecurityDao.SetShare(r); }
public bool IsShared(object entryId, FileEntryType type) { return(SecurityDao.IsShared(entryId, type)); }
public void DeleteShareRecords(IEnumerable <FileShareRecord> records) { SecurityDao.DeleteShareRecords(records); }
public IEnumerable <FileShareRecord> GetPureShareRecords(FileEntry <string> entry) { return(SecurityDao.GetPureShareRecords(entry)); }
public IEnumerable <FileShareRecord> GetShares(IEnumerable <Guid> subjects) { return(SecurityDao.GetShares(subjects)); }
public void RemoveSubject(Guid subject) { SecurityDao.RemoveSubject(subject); }