예제 #1
0
            new ConcurrentDictionary <int, object>(); /*Use SYNCHRONIZED for cross thread blocks*/

        public object GetFolderShare(IFolderDao folderDao)
        {
            if (CoreBaseSettings.Personal)
            {
                return(null);
            }
            if (IsOutsider)
            {
                return(null);
            }

            if (!ShareFolderCache.TryGetValue(TenantManager.GetCurrentTenant().TenantId, out var sharedFolderId))
            {
                sharedFolderId = folderDao.GetFolderIDShare(true);

                if (!sharedFolderId.Equals(0))
                {
                    ShareFolderCache[TenantManager.GetCurrentTenant().TenantId] = sharedFolderId;
                }
            }

            return(sharedFolderId);
        }
예제 #2
0
        public static List <Folder> GetBreadCrumbs(object folderId, IFolderDao folderDao)
        {
            var breadCrumbs = GetFilesSecurity().FilterRead(folderDao.GetParentFolders(folderId)).ToList();

            var firstVisible = breadCrumbs.ElementAtOrDefault(0);

            if (firstVisible != null && firstVisible.FolderType == FolderType.DEFAULT) //not first level
            {
                Folder root = null;

                if (string.IsNullOrEmpty(firstVisible.ProviderName))
                {
                    root = folderDao.GetFolder(folderDao.GetFolderIDShare(false));
                }
                else
                {
                    switch (firstVisible.RootFolderType)
                    {
                    case FolderType.USER:
                        root = folderDao.GetFolder(folderDao.GetFolderIDUser(false));
                        break;

                    case FolderType.COMMON:
                        root = folderDao.GetFolder(folderDao.GetFolderIDCommon(false));
                        break;
                    }
                }
                if (root != null)
                {
                    firstVisible.ParentFolderID = root.ID;
                    breadCrumbs.Insert(0, root);
                }
            }

            return(breadCrumbs);
        }
예제 #3
0
        public static List<Folder> GetBreadCrumbs(object folderId, IFolderDao folderDao)
        {
            var breadCrumbs = GetFilesSecurity().FilterRead(folderDao.GetParentFolders(folderId)).ToList();

            var firstVisible = breadCrumbs.ElementAtOrDefault(0);

            if (firstVisible != null && firstVisible.FolderType == FolderType.DEFAULT) //not first level
            {
                Folder root = null;

                if (string.IsNullOrEmpty(firstVisible.ProviderName))
                {
                    root = folderDao.GetFolder(folderDao.GetFolderIDShare(false));
                }
                else
                {
                    switch (firstVisible.RootFolderType)
                    {
                        case FolderType.USER:
                            root = folderDao.GetFolder(folderDao.GetFolderIDUser(false));
                            break;
                        case FolderType.COMMON:
                            root = folderDao.GetFolder(folderDao.GetFolderIDCommon(false));
                            break;
                    }
                }
                if (root != null)
                {
                    firstVisible.ParentFolderID = root.ID;
                    breadCrumbs.Insert(0, root);
                }
            }

            return breadCrumbs;
        }