コード例 #1
0
        void IDestinationFolder.SetACL(SecurityProp secProp, PropValueData[][] aclData)
        {
            if (base.Mailbox.ServerVersion >= Server.E15MinVersion)
            {
                MrsTracer.Provider.Warning("MAPI provider does not support SetACL against E15+ mailboxes", new object[0]);
                return;
            }
            PropValueData[][] acl       = ((IFolder)this).GetACL(secProp);
            FolderACL         folderACL = new FolderACL(aclData);

            RowEntry[] array = folderACL.UpdateExisting(acl);
            if (array == null)
            {
                MrsTracer.Provider.Debug("Folder ACL is unchanged.", new object[0]);
                return;
            }
            MrsTracer.Provider.Debug("Applying {0} updates to the folder ACL.", new object[]
            {
                array.Length
            });
            ModifyTableFlags modifyTableFlags = ModifyTableFlags.None;

            if (secProp == SecurityProp.FreeBusyNTSD)
            {
                modifyTableFlags |= ModifyTableFlags.FreeBusy;
            }
            using (base.Mailbox.RHTracker.Start())
            {
                using (MapiModifyTable mapiModifyTable = (MapiModifyTable)base.Folder.OpenProperty(PropTag.AclTable, InterfaceIds.IExchangeModifyTable, 0, OpenPropertyFlags.DeferredErrors))
                {
                    mapiModifyTable.ModifyTable(modifyTableFlags, array);
                }
            }
        }
コード例 #2
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());
        }