Пример #1
0
        // Token: 0x06000DB2 RID: 3506 RVA: 0x00033824 File Offset: 0x00031A24
        private GroupAssociationNotificationPayload GetPayloadFromNotification(QueryNotification notification)
        {
            GroupAssociationNotificationPayload groupAssociationNotificationPayload = new GroupAssociationNotificationPayload();

            groupAssociationNotificationPayload.SubscriptionId = base.SubscriptionId;
            groupAssociationNotificationPayload.EventType      = notification.EventType;
            groupAssociationNotificationPayload.Source         = MailboxLocation.FromMailboxContext(base.UserContext);
            if (notification.EventType != QueryNotificationType.RowDeleted)
            {
                string itemProperty  = GroupAssociationNotificationHandler.GetItemProperty <string>(notification, 0, string.Empty);
                string itemProperty2 = GroupAssociationNotificationHandler.GetItemProperty <string>(notification, 1, string.Empty);
                bool   itemProperty3 = GroupAssociationNotificationHandler.GetItemProperty <bool>(notification, 2, false);
                GroupMailboxLocator groupMailboxLocator = new GroupMailboxLocator(this.adSession, itemProperty, itemProperty2);
                ADUser aduser = groupMailboxLocator.FindAdUser();
                if (aduser != null)
                {
                    groupAssociationNotificationPayload.Group = new ModernGroupType
                    {
                        DisplayName = aduser.DisplayName,
                        SmtpAddress = aduser.PrimarySmtpAddress.ToString(),
                        IsPinned    = itemProperty3
                    };
                }
                else
                {
                    ExTraceGlobals.NotificationsCallTracer.TraceError <string, string>((long)this.GetHashCode(), "GroupAssociationNotificationHandler.GetPayloadFromNotification: Could not find Group in AD with ExternalObjectId {0} or LegacyDn {1}", itemProperty, itemProperty2);
                }
            }
            return(groupAssociationNotificationPayload);
        }
Пример #2
0
 public EscalationGetter(GroupMailboxLocator group, IMailboxSession groupSession)
 {
     ArgumentValidator.ThrowIfNull("group", group);
     ArgumentValidator.ThrowIfNull("groupSession", groupSession);
     this.group        = group;
     this.groupSession = groupSession;
 }
Пример #3
0
        private LocalAssociationStore GetAssociationStore(MailboxSession adminMailboxSession, IMailboxAssociationPerformanceTracker performanceTracker)
        {
            IRecipientSession adrecipientSession = adminMailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid);
            IMailboxLocator   mailboxLocator     = new GroupMailboxLocator(adrecipientSession, this.groupMailboxToLogon.ExternalDirectoryObjectId, this.groupMailboxToLogon.LegacyDn);

            return(new LocalAssociationStore(mailboxLocator, adminMailboxSession, false, new XSOFactory(), performanceTracker, MailboxAssociationDiagnosticsFrameFactory.Default.CreateLogger(this.groupMailboxToLogon.MailboxInfo.MailboxGuid, this.organizationId)));
        }
Пример #4
0
 private void WriteMembersToGroupIfRequired(MailboxSession mailboxSession)
 {
     if (this.addedMembers == null && this.removedMembers == null)
     {
         return;
     }
     GroupMailboxAccessLayer.Execute("UpdateGroupMailboxViaXSO.WriteMembersToGroupIfRequired", this.adSession, mailboxSession, delegate(GroupMailboxAccessLayer accessLayer)
     {
         GroupMailboxLocator group = GroupMailboxLocator.Instantiate(this.adSession, this.group);
         accessLayer.SetMembershipState(this.executingUser, this.addedMembers, this.removedMembers, group);
     });
 }
Пример #5
0
        protected virtual List <string> GetEscalatedUsersList(IMailboxSession session, out string yammerEscalateAddress)
        {
            ProxyAddress proxyAddress = ProxyAddress.Parse(session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString());

            if (proxyAddress is InvalidProxyAddress)
            {
                GroupEscalation.Tracer.TraceError <string>((long)this.GetHashCode(), "GroupEscalation.GetEscalatedUsersList: Escalation failed. Could not parse smtp address: {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString());
                yammerEscalateAddress = string.Empty;
                return(new List <string>());
            }
            GroupMailboxLocator groupMailboxLocator = GroupMailboxLocator.Instantiate(session.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid), proxyAddress);

            yammerEscalateAddress = groupMailboxLocator.GetYammerGroupAddress();
            EscalationGetter escalationGetter = new EscalationGetter(groupMailboxLocator, session);

            return(escalationGetter.Execute());
        }
Пример #6
0
        private ADRawEntry[] GetMemberRawEntriesFromMailbox(IRecipientSession recipientSession, ADUser adUser, MailboxSession mailboxSession)
        {
            GroupMailboxLocator groupLocator      = GroupMailboxLocator.Instantiate(recipientSession, adUser);
            List <string>       exchangeLegacyDNs = new List <string>(10);

            GroupMailboxAccessLayer.Execute("Get-GroupMailbox", recipientSession, mailboxSession, delegate(GroupMailboxAccessLayer accessLayer)
            {
                IEnumerable <UserMailbox> members = accessLayer.GetMembers(groupLocator, false, null);
                foreach (UserMailbox userMailbox in members)
                {
                    exchangeLegacyDNs.Add(userMailbox.Locator.LegacyDn);
                }
            });
            string[]          array = exchangeLegacyDNs.ToArray();
            List <ADRawEntry> list  = new List <ADRawEntry>(array.Length);

            try
            {
                Result <ADRawEntry>[] array2 = recipientSession.FindByExchangeLegacyDNs(array, IdentityDetails.Properties);
                for (int i = 0; i < array2.Length; i++)
                {
                    Result <ADRawEntry> result = array2[i];
                    if (result.Error != null)
                    {
                        this.WriteWarning(Strings.WarningUnableToResolveUser(array[i].ToString(), result.Error.ToString()));
                    }
                    else if (result.Data == null)
                    {
                        base.WriteVerbose(Strings.WarningUnableToResolveUser(array[i].ToString(), string.Empty));
                    }
                    else
                    {
                        list.Add(result.Data);
                    }
                }
            }
            catch (LocalizedException ex)
            {
                base.WriteWarning("Unable to retrieve members details from mailbox due exception: " + ex.Message);
            }
            return(list.ToArray());
        }
        // Token: 0x06001535 RID: 5429 RVA: 0x000792F8 File Offset: 0x000774F8
        private void ReplicateOutOfSyncAssociations(MailboxSession mailboxSession, ADUser masterAdUser, IRecipientSession adSession, GroupMailboxAccessLayer accessLayer)
        {
            mailboxSession.Mailbox.GetValueOrDefault <MailboxAssociationProcessingFlags>(MailboxSchema.MailboxAssociationProcessingFlags, MailboxAssociationProcessingFlags.None);
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for GroupMailbox via MailboxAssistant WorkCycle");
                GroupMailboxLocator masterLocator = GroupMailboxLocator.Instantiate(adSession, masterAdUser);
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator);
                return;
            }
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.UserMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for UserMailbox via MailboxAssistant WorkCycle");
                UserMailboxLocator masterLocator2 = UserMailboxLocator.Instantiate(adSession, masterAdUser);
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator2);
                return;
            }
            string message = string.Format("Replication of Mailbox Associations is not yet supported for mailbox of type {0}", masterAdUser.RecipientTypeDetails);

            MailboxAssociationReplicationAssistant.Tracer.TraceError((long)this.GetHashCode(), message);
            throw new NotImplementedException(message);
        }
Пример #8
0
        private List <string> CalculateTargetUsers(ADUser adUser, IRecipientSession adSession, StoreSession session)
        {
            GroupMailboxLocator groupMailboxLocator = GroupMailboxLocator.Instantiate(adSession, new SmtpProxyAddress(session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), true));
            ADUser aduser = adUser ?? groupMailboxLocator.FindAdUser();

            if (aduser == null)
            {
                return(new List <string>());
            }
            List <string>    groupPinners = this.GetGroupPinners(session, groupMailboxLocator);
            List <string>    groupOwners  = this.GetGroupOwners(aduser);
            HashSet <string> hashSet      = new HashSet <string>(groupPinners);

            foreach (string item in groupOwners)
            {
                hashSet.Add(item);
            }
            if (hashSet.Count != 0)
            {
                List <string> groupSubscribers = this.GetGroupSubscribers(session, groupMailboxLocator);
                foreach (string item2 in groupSubscribers)
                {
                    hashSet.Remove(item2);
                }
                List <string> list = new List <string>();
                foreach (string text in hashSet)
                {
                    if (!this.IsUserFlighted(adSession, text))
                    {
                        list.Add(text);
                    }
                }
                foreach (string item3 in list)
                {
                    hashSet.Remove(item3);
                }
            }
            return(hashSet.ToList <string>());
        }
        // Token: 0x06001536 RID: 5430 RVA: 0x000793B0 File Offset: 0x000775B0
        private void ReplicateAssociations(ADUser masterAdUser, IRecipientSession adSession, ICollection <IMailboxLocator> itemsToReplicate, GroupMailboxAccessLayer accessLayer)
        {
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for GroupMailbox via MailboxAssistant.RunNow");
                GroupMailboxLocator  masterLocator = GroupMailboxLocator.Instantiate(adSession, masterAdUser);
                UserMailboxLocator[] slaveLocators = itemsToReplicate.Cast <UserMailboxLocator>().ToArray <UserMailboxLocator>();
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator, slaveLocators);
                return;
            }
            if (masterAdUser.RecipientTypeDetails == RecipientTypeDetails.UserMailbox)
            {
                MailboxAssociationReplicationAssistant.Tracer.TraceDebug((long)this.GetHashCode(), "Replicating associations for UserMailbox via MailboxAssistant.RunNow");
                UserMailboxLocator    masterLocator2 = UserMailboxLocator.Instantiate(adSession, masterAdUser);
                GroupMailboxLocator[] slaveLocators2 = itemsToReplicate.Cast <GroupMailboxLocator>().ToArray <GroupMailboxLocator>();
                accessLayer.ReplicateOutOfSyncAssociation(masterLocator2, slaveLocators2);
                return;
            }
            string message = string.Format("Replication of Mailbox Associations is not yet supported for mailbox of type {0}", masterAdUser.RecipientTypeDetails);

            MailboxAssociationReplicationAssistant.Tracer.TraceError((long)this.GetHashCode(), message);
            throw new NotImplementedException(message);
        }
Пример #10
0
        internal string[] GetMembers(ADUser groupMailbox, IRecipientSession recipientSession, string operation)
        {
            List <string> externalDirectoryObjectIds = new List <string>(10);

            this.WriteVerbose("Getting members from group mailbox: {0}", new object[]
            {
                groupMailbox.Id
            });
            using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(ExchangePrincipal.FromADUser(groupMailbox, RemotingOptions.AllowCrossSite), CultureInfo.InvariantCulture, "Client=Management;Action=" + operation))
            {
                GroupMailboxAccessLayer.Execute(operation, recipientSession, mailboxSession, delegate(GroupMailboxAccessLayer accessLayer)
                {
                    GroupMailboxLocator group         = GroupMailboxLocator.Instantiate(recipientSession, groupMailbox);
                    IEnumerable <UserMailbox> members = accessLayer.GetMembers(group, false, null);
                    foreach (UserMailbox userMailbox in members)
                    {
                        if (string.IsNullOrEmpty(userMailbox.Locator.ExternalId))
                        {
                            this.WriteVerbose("Group member is missing ExternalId: {0}", new object[]
                            {
                                userMailbox.Locator.LegacyDn
                            });
                        }
                        else
                        {
                            externalDirectoryObjectIds.Add(userMailbox.Locator.ExternalId);
                            this.WriteVerbose("Group member: {0}, ExternalDirectoryObjectId={1}", new object[]
                            {
                                userMailbox.Locator.LegacyDn,
                                userMailbox.Locator.ExternalId
                            });
                        }
                    }
                });
            }
            return(externalDirectoryObjectIds.ToArray());
        }
Пример #11
0
 public override MailboxLocator CreateMasterLocator()
 {
     return(GroupMailboxLocator.Instantiate(base.AdSession, base.CurrentMailbox));
 }
Пример #12
0
        protected virtual List <string> GetGroupSubscribers(StoreSession session, GroupMailboxLocator groupMailboxLocator)
        {
            EscalationGetter escalationGetter = new EscalationGetter(groupMailboxLocator, session as MailboxSession);

            return(escalationGetter.Execute());
        }
Пример #13
0
        protected virtual List <string> GetGroupPinners(StoreSession session, GroupMailboxLocator groupMailboxLocator)
        {
            PinnersGetter pinnersGetter = new PinnersGetter(groupMailboxLocator, session as MailboxSession);

            return(pinnersGetter.Execute());
        }