Example #1
0
        public RowEntry[] UpdateExisting(PropValueData[][] existingAclData)
        {
            FolderACL       folderACL = new FolderACL(existingAclData);
            List <RowEntry> list      = new List <RowEntry>();

            foreach (FolderACL.FolderACE folderACE in folderACL.Aces)
            {
                if (this.FindMatchingACE(folderACE) == null)
                {
                    list.Add(FolderACL.FolderACE.Remove(folderACE.MemberId));
                }
            }
            foreach (FolderACL.FolderACE folderACE2 in this.Aces)
            {
                FolderACL.FolderACE folderACE3 = folderACL.FindMatchingACE(folderACE2);
                if (folderACE3 != null)
                {
                    if (folderACE2.MemberRights != folderACE3.MemberRights)
                    {
                        list.Add(FolderACL.FolderACE.Update(folderACE3.MemberId, folderACE2.MemberRights));
                    }
                }
                else
                {
                    list.Add(FolderACL.FolderACE.Add(folderACE2.MemberEntryId, folderACE2.MemberRights));
                }
            }
            if (list.Count <= 0)
            {
                return(null);
            }
            return(list.ToArray());
        }
Example #2
0
        public FolderACL.FolderACE FindMatchingACE(FolderACL.FolderACE ace)
        {
            switch (ace.AceType)
            {
            case FolderACEType.Regular:
            {
                FolderACL.FolderACE result;
                if (this.ByEntryId.TryGetValue(ace.MemberEntryId, out result))
                {
                    return(result);
                }
                break;
            }

            case FolderACEType.Default:
                return(this.DefaultACE);

            case FolderACEType.Anonymous:
                return(this.AnonymousACE);
            }
            return(null);
        }
Example #3
0
        public FolderACL(PropValueData[][] aclData)
        {
            this.aces         = new List <FolderACL.FolderACE>();
            this.defaultACE   = null;
            this.anonymousACE = null;
            this.byEntryId    = new EntryIdMap <FolderACL.FolderACE>();
            if (aclData != null)
            {
                int i = 0;
                while (i < aclData.Length)
                {
                    PropValueData[]     aceData   = aclData[i];
                    FolderACL.FolderACE folderACE = new FolderACL.FolderACE(aceData);
                    switch (folderACE.AceType)
                    {
                    case FolderACEType.Invalid:
IL_8F:
                        i++;
                        continue;

                    case FolderACEType.Regular:
                        this.byEntryId[folderACE.MemberEntryId] = folderACE;
                        break;

                    case FolderACEType.Default:
                        this.defaultACE = folderACE;
                        break;

                    case FolderACEType.Anonymous:
                        this.anonymousACE = folderACE;
                        break;
                    }
                    this.aces.Add(folderACE);
                    goto IL_8F;
                }
            }
        }