public void AddRange(FolderPermissionCollection folderPermissions)
 {
     foreach (FolderPermissionInfo permission in folderPermissions)
     {
         List.Add(permission);
     }
 }
        public virtual FolderPermissionCollection GetFolderPermissionsCollectionByFolder(int PortalID, string Folder)
        {
            bool   bFound        = false;
            string dictionaryKey = Folder;

            if (string.IsNullOrEmpty(dictionaryKey))
            {
                dictionaryKey = "[PortalRoot]";
            }
            Dictionary <string, FolderPermissionCollection> dicFolderPermissions = GetFolderPermissions(PortalID);
            FolderPermissionCollection folderPermissions = null;

            bFound = dicFolderPermissions.TryGetValue(dictionaryKey, out folderPermissions);
            if (!bFound)
            {
                folderPermissions = new FolderPermissionCollection(CBO.FillCollection(dataProvider.GetFolderPermissionsByFolderPath(PortalID, Folder, -1), typeof(FolderPermissionInfo)), Folder);
            }
            return(folderPermissions);
        }
        private object GetFolderPermissionsCallBack(CacheItemArgs cacheItemArgs)
        {
            int         PortalID = (int)cacheItemArgs.ParamList[0];
            IDataReader dr       = dataProvider.GetFolderPermissionsByPortal(PortalID);
            Dictionary <string, FolderPermissionCollection> dic = new Dictionary <string, FolderPermissionCollection>();

            try
            {
                FolderPermissionInfo obj;
                while (dr.Read())
                {
                    obj = CBO.FillObject <FolderPermissionInfo>(dr, false);
                    string dictionaryKey = obj.FolderPath;
                    if (string.IsNullOrEmpty(dictionaryKey))
                    {
                        dictionaryKey = "[PortalRoot]";
                    }
                    if (dic.ContainsKey(dictionaryKey))
                    {
                        dic[dictionaryKey].Add(obj);
                    }
                    else
                    {
                        FolderPermissionCollection collection = new FolderPermissionCollection();
                        collection.Add(obj);
                        dic.Add(dictionaryKey, collection);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
            finally
            {
                CBO.CloseDataReader(dr, true);
            }
            return(dic);
        }
        public static bool HasFolderPermission(FolderPermissionCollection objFolderPermissions, string PermissionKey)
        {
            bool hasPermission = provider.HasFolderPermission(objFolderPermissions, "WRITE");

            if (!hasPermission)
            {
                if (PermissionKey.Contains(","))
                {
                    foreach (string permission in PermissionKey.Split(','))
                    {
                        if (provider.HasFolderPermission(objFolderPermissions, permission))
                        {
                            hasPermission = true;
                            break;
                        }
                    }
                }
                else
                {
                    hasPermission = provider.HasFolderPermission(objFolderPermissions, PermissionKey);
                }
            }
            return(hasPermission);
        }
 public virtual bool HasFolderPermission(FolderPermissionCollection objFolderPermissions, string PermissionKey)
 {
     return(PortalSecurity.IsInRoles(objFolderPermissions.ToString(PermissionKey)));
 }
 public FolderPermissionCollection(FolderPermissionCollection folderPermissions)
 {
     AddRange(folderPermissions);
 }
 public bool CompareTo(FolderPermissionCollection objFolderPermissionCollection)
 {
     if (objFolderPermissionCollection.Count != this.Count)
     {
         return false;
     }
     InnerList.Sort(new CompareFolderPermissions());
     objFolderPermissionCollection.InnerList.Sort(new CompareFolderPermissions());
     for (int i = 0; i <= this.Count - 1; i++)
     {
         if (objFolderPermissionCollection[i].FolderPermissionID != this[i].FolderPermissionID || objFolderPermissionCollection[i].AllowAccess != this[i].AllowAccess)
         {
             return false;
         }
     }
     return true;
 }
 public FolderPermissionCollection(FolderPermissionCollection folderPermissions)
 {
     AddRange(folderPermissions);
 }