// Token: 0x06000E48 RID: 3656 RVA: 0x00055A2C File Offset: 0x00053C2C protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog) { MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession; if (mailboxSession == null) { return; } ADUser aduser = SharingPolicyAssistant.GetADUser(mailboxSession.MailboxOwner, mailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid)); if (aduser == null) { return; } if (ADRecipient.IsSystemMailbox(aduser.RecipientTypeDetails)) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal, RecipientTypeDetails>((long)this.GetHashCode(), "{0}: Skipping the mailbox processing as it is a system mailbox. RecipientTypeDetails {1}.", mailboxSession.MailboxOwner, aduser.RecipientTypeDetails); return; } SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Begin process mailbox", mailboxSession.MailboxOwner); SharingPolicyCache sharingPolicyCache = SharingPolicyCache.Get(aduser); bool flag = false; if (sharingPolicyCache != null) { if (!this.IsMailboxNeedingPolicyUpdate(mailboxSession, sharingPolicyCache)) { return; } flag = this.ApplyPolicy(mailboxSession, sharingPolicyCache.Policy); } if (flag) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Storing applied policy to mailbox table.", mailboxSession.MailboxOwner); SharingPolicyAssistant.UpdateMailboxData(mailboxSession.Mailbox, (aduser.SharingPolicy == null && !sharingPolicyCache.BelongsToDehydratedContainer) ? SharingPolicyCache.DynamicDefaultPolicy.ObjectGuid.ToByteArray() : sharingPolicyCache.Policy.Id.ObjectGuid.ToByteArray(), sharingPolicyCache.Hash); } else { SharingPolicyAssistant.Tracer.TraceWarning <IExchangePrincipal>(0L, "{0}: Unable to find sharing policy for this mailbox.", mailboxSession.MailboxOwner); ExDateTime?exDateTime = mailboxSession.Mailbox.TryGetProperty(MailboxSchema.LastSharingPolicyAppliedTime) as ExDateTime?; byte[] array = mailboxSession.Mailbox.TryGetProperty(MailboxSchema.LastSharingPolicyAppliedHash) as byte[]; if (exDateTime == null || array != null) { SharingPolicyAssistant.UpdateMailboxData(mailboxSession.Mailbox, null, null); } else { TimeSpan retryTimeSpan = ExDateTime.UtcNow.Subtract(exDateTime.Value); if (ExDateTime.UtcNow.Subtract(exDateTime.Value) > SharingPolicyAssistant.RetryThresholdLimit) { SharingPolicyAssistant.SubmitInformationalWatson(mailboxSession.MailboxOwner, retryTimeSpan); SharingPolicyAssistant.UpdateMailboxData(mailboxSession.Mailbox, null, null); } } } SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: End process mailbox", mailboxSession.MailboxOwner); }
// Token: 0x06000E4D RID: 3661 RVA: 0x00055FE4 File Offset: 0x000541E4 private void ApplyPolicyForExternalSharing(object[] row, MailboxData mailboxData, FolderData folderData) { RawSecurityDescriptor rawSecurityDescriptor = row[2] as RawSecurityDescriptor; if (rawSecurityDescriptor == null) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal, StoreId>((long)this.GetHashCode(), "{0}: Got null security descriptor property from folder query for folder {1}", mailboxData.MailboxSession.MailboxOwner, folderData.Id); this.ApplyPolicyToFolder(mailboxData.SharingPolicy, folderData); return; } SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal, StoreId, RawSecurityDescriptor>((long)this.GetHashCode(), "{0}: Security descriptor retrieved from folder {1}: {2}", mailboxData.MailboxSession.MailboxOwner, folderData.Id, rawSecurityDescriptor); if (SharingPolicyAssistant.HasExternalUser(mailboxData.ExternalUserCollection, rawSecurityDescriptor)) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Security descriptor contains external users, need to apply policy to folder", mailboxData.MailboxSession.MailboxOwner); this.ApplyPolicyToFolder(mailboxData.SharingPolicy, folderData); } }