Beispiel #1
0
 internal ADParticipantEntryId(string legacyDN, LegacyRecipientDisplayType?legacyRecipientDisplayType, bool useWabFormat)
 {
     this.legacyDN = legacyDN;
     this.legacyRecipientDisplayType = legacyRecipientDisplayType;
     this.flags        = ADParticipantEntryId.ReplaceObjectTypeInformation(ParticipantEntryId.WabEntryFlag.HomeFax | ParticipantEntryId.WabEntryFlag.OtherFax | ParticipantEntryId.WabEntryFlag.Outlook, ref this.legacyRecipientDisplayType, this.legacyDN);
     this.useWabFormat = useWabFormat;
 }
Beispiel #2
0
        internal ADParticipantEntryId(ParticipantEntryId.WabEntryFlag?flags, ParticipantEntryId.Reader reader)
        {
            uint num = reader.ReadUInt32();

            if (num != 1U)
            {
                throw new NotSupportedException(ServerStrings.ExUnsupportedABProvider("Exchange WAB", num.ToString()));
            }
            this.legacyRecipientDisplayType = new LegacyRecipientDisplayType?((LegacyRecipientDisplayType)reader.ReadUInt32());
            if (flags == null && this.legacyRecipientDisplayType == LegacyRecipientDisplayType.MailUser)
            {
                this.legacyRecipientDisplayType = null;
            }
            this.legacyDN     = reader.ReadZString(CTSGlobals.AsciiEncoding);
            this.flags        = ADParticipantEntryId.ReplaceObjectTypeInformation(flags ?? ParticipantEntryId.WabEntryFlag.Envelope, ref this.legacyRecipientDisplayType, this.legacyDN);
            this.useWabFormat = (flags != null);
            reader.EnsureEnd();
        }
Beispiel #3
0
        private void NormalizeADEntryIds(ParticipantEntryId[] mainEntryIds, ParticipantEntryId[] oneOffEntryIds)
        {
            List <string> list  = new List <string>();
            List <int>    list2 = new List <int>();

            for (int i = 0; i < mainEntryIds.Length; i++)
            {
                ADParticipantEntryId     adparticipantEntryId     = mainEntryIds[i] as ADParticipantEntryId;
                OneOffParticipantEntryId oneOffParticipantEntryId = (OneOffParticipantEntryId)oneOffEntryIds[i];
                if (adparticipantEntryId != null && (oneOffParticipantEntryId == null || adparticipantEntryId.IsDL == null))
                {
                    list.Add(adparticipantEntryId.LegacyDN);
                    list2.Add(i);
                }
                else if (oneOffParticipantEntryId != null && oneOffParticipantEntryId.EmailAddressType == "EX")
                {
                    list.Add(oneOffParticipantEntryId.EmailAddress);
                    list2.Add(i);
                }
            }
            if (list.Count > 0)
            {
                object[][] array = DistributionList.LookupInAD(() => base.Session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), list, DistributionList.adLookupProperties);
                for (int j = 0; j < list.Count; j++)
                {
                    if (array[j] != null)
                    {
                        int num = list2[j];
                        if (mainEntryIds[num] is ADParticipantEntryId && mainEntryIds[num].IsDL == null)
                        {
                            bool flag = DistributionList.IsDL((RecipientType)array[j][2]);
                            mainEntryIds[num] = new ADParticipantEntryId(list[j], new LegacyRecipientDisplayType?(flag ? LegacyRecipientDisplayType.DistributionList : LegacyRecipientDisplayType.MailUser), true);
                        }
                        OneOffParticipantEntryId oneOffParticipantEntryId2 = oneOffEntryIds[num] as OneOffParticipantEntryId;
                        oneOffEntryIds[num] = new OneOffParticipantEntryId((oneOffParticipantEntryId2 != null) ? oneOffParticipantEntryId2.EmailDisplayName : ((string)array[j][0]), array[j][1].ToString(), "SMTP");
                    }
                }
            }
        }
        internal DistributionListMember(DistributionList distributionList, ParticipantEntryId mainEntryId, OneOffParticipantEntryId oneOffEntryId)
        {
            this.distributionList = distributionList;
            this.memberStatus     = MemberStatus.Normal;
            Participant.Builder  builder = new Participant.Builder();
            ADParticipantEntryId adparticipantEntryId = mainEntryId as ADParticipantEntryId;

            if (adparticipantEntryId != null)
            {
                builder.SetPropertiesFrom(adparticipantEntryId);
                if (oneOffEntryId != null)
                {
                    builder.DisplayName = oneOffEntryId.EmailDisplayName;
                    if (!string.IsNullOrEmpty(oneOffEntryId.EmailAddress) && Participant.RoutingTypeEquals(oneOffEntryId.EmailAddressType, "SMTP"))
                    {
                        builder[ParticipantSchema.SmtpAddress] = oneOffEntryId.EmailAddress;
                    }
                }
                this.participant = builder.ToParticipant();
            }
            else
            {
                StoreParticipantEntryId storeParticipantEntryId = mainEntryId as StoreParticipantEntryId;
                if (storeParticipantEntryId != null && oneOffEntryId != null)
                {
                    builder.SetPropertiesFrom(oneOffEntryId);
                    builder.SetPropertiesFrom(storeParticipantEntryId);
                    this.participant = builder.ToParticipant();
                }
                else
                {
                    OneOffParticipantEntryId oneOffParticipantEntryId = mainEntryId as OneOffParticipantEntryId;
                    if (oneOffParticipantEntryId == null)
                    {
                        oneOffParticipantEntryId = oneOffEntryId;
                        this.memberStatus        = MemberStatus.Demoted;
                    }
                    if (oneOffParticipantEntryId != null)
                    {
                        builder.SetPropertiesFrom(oneOffParticipantEntryId);
                        this.participant = builder.ToParticipant();
                    }
                    else
                    {
                        this.memberStatus = MemberStatus.Unrecognized;
                    }
                }
            }
            if (this.mainEntryId == null)
            {
                this.mainEntryId = mainEntryId;
            }
            if (this.oneOffEntryId == null)
            {
                this.oneOffEntryId = oneOffEntryId;
            }
            ExTraceGlobals.StorageTracer.Information((long)this.GetHashCode(), "Loaded a {1} DL member \"{0}\". MainEntryId=\"{2}\", OneOffEntryId=\"{3}\"", new object[]
            {
                this.participant,
                this.memberStatus,
                this.mainEntryId,
                this.oneOffEntryId
            });
        }
Beispiel #5
0
        private void LoadFrom(MapiAclTableAdapter mapiAclTableAdapter)
        {
            IRecipientSession      recipientSession = null;
            ExternalUserCollection disposable       = null;

            AclTableEntry[] all = mapiAclTableAdapter.GetAll();
            try
            {
                foreach (AclTableEntry aclTableEntry in all)
                {
                    long         memberId      = aclTableEntry.MemberId;
                    byte[]       memberEntryId = aclTableEntry.MemberEntryId;
                    string       memberName    = aclTableEntry.MemberName;
                    MemberRights memberRights  = aclTableEntry.MemberRights;
                    if (memberId == 0L)
                    {
                        this.defaultMemberPermission = this.permissionSet.CreatePermission(new PermissionSecurityPrincipal(PermissionSecurityPrincipal.SpecialPrincipalType.Default), memberRights, memberId);
                    }
                    else if (memberId == -1L)
                    {
                        this.anonymousMemberPermission = this.permissionSet.CreatePermission(new PermissionSecurityPrincipal(PermissionSecurityPrincipal.SpecialPrincipalType.Anonymous), memberRights, memberId);
                    }
                    else if (memberEntryId != null)
                    {
                        ADParticipantEntryId adparticipantEntryId = mapiAclTableAdapter.TryGetParticipantEntryId(memberEntryId);
                        if (adparticipantEntryId != null)
                        {
                            if (recipientSession == null)
                            {
                                recipientSession = mapiAclTableAdapter.Session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid);
                            }
                            ADRecipient adrecipient = null;
                            try
                            {
                                adrecipient = recipientSession.FindByLegacyExchangeDN(adparticipantEntryId.LegacyDN);
                            }
                            catch (DataValidationException)
                            {
                                ExTraceGlobals.StorageTracer.TraceDebug <string, string>(0L, "PermissionTable::PermissionTable. Caught exception from ADSesssion.FindByLegacyExchangeDN when trying to find a recipient from the ACL Table. Recipient name = {0}, LegDN = {1}.", memberName, adparticipantEntryId.LegacyDN);
                                this.AddUnknownEntry(memberName, memberId, memberEntryId, memberRights);
                                goto IL_17E;
                            }
                            if (adrecipient != null)
                            {
                                Permission permission = this.permissionSet.CreatePermission(new PermissionSecurityPrincipal(adrecipient), memberRights, memberId);
                                this.AddPermissionEntry(permission.Principal, permission);
                            }
                            else
                            {
                                ExTraceGlobals.StorageTracer.TraceDebug <string, string>(0L, "PermissionTable::PermissionTable. Did not find the recipient from the ACL table in the AD. Recipient name = {0}, LegDN = {1}.", memberName, adparticipantEntryId.LegacyDN);
                                this.AddUnknownEntry(memberName, memberId, memberEntryId, memberRights);
                            }
                        }
                        else
                        {
                            this.AddNonADEntry(mapiAclTableAdapter, ref disposable, memberName, memberId, memberEntryId, memberRights);
                        }
                    }
                    else
                    {
                        ExTraceGlobals.StorageTracer.TraceDebug <string>(0L, "PermissionTable::PermissionTable. Found a member in the ACL table (other than anonymous and default) without a member entry id. Recipient Name = {0}.", memberName);
                        this.AddUnknownEntry(memberName, memberId, memberEntryId, memberRights);
                    }
                    IL_17E :;
                }
            }
            finally
            {
                Util.DisposeIfPresent(disposable);
            }
        }