protected override void WriteAces(ADObjectId id, IEnumerable <ActiveDirectoryAccessRule> aces) { foreach (ActiveDirectoryAccessRule ace in aces) { MailboxAcePresentationObject mailboxAcePresentationObject = new MailboxAcePresentationObject(ace, id); mailboxAcePresentationObject.ResetChangeTracking(true); base.WriteObject(mailboxAcePresentationObject); } }
protected override void WriteResult(IConfigurable dataObject) { TaskLogger.LogEnter(); this.HasObjectMatchingIdentity = true; ADUser aduser = (ADUser)dataObject; if (aduser.Database == null || aduser.ExchangeGuid == Guid.Empty) { base.Validate(aduser); } else { ActiveDirectorySecurity activeDirectorySecurity = PermissionTaskHelper.ReadMailboxSecurityDescriptor((ADUser)dataObject, PermissionTaskHelper.GetReadOnlySession(base.DomainController), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError)); if (!this.Owner.IsPresent) { AuthorizationRuleCollection accessRules = activeDirectorySecurity.GetAccessRules(true, true, typeof(SecurityIdentifier)); int num = 0; while (accessRules.Count > num) { ActiveDirectoryAccessRule activeDirectoryAccessRule = (ActiveDirectoryAccessRule)accessRules[num]; if (this.SecurityPrincipal == null || this.SecurityPrincipal.Sid == activeDirectoryAccessRule.IdentityReference || this.SecurityPrincipal.SidHistory.Contains(activeDirectoryAccessRule.IdentityReference as SecurityIdentifier)) { MailboxAcePresentationObject mailboxAcePresentationObject = new MailboxAcePresentationObject(activeDirectoryAccessRule, ((ADRawEntry)dataObject).Id); if (Globals.IsDatacenter && base.TenantGlobalCatalogSession != null) { SecurityIdentifier securityIdentifier = (SecurityIdentifier)activeDirectoryAccessRule.IdentityReference; ADRecipient adrecipient = null; try { adrecipient = base.TenantGlobalCatalogSession.FindBySid(securityIdentifier); } catch { } if (adrecipient != null) { string friendlyName = (!string.IsNullOrEmpty(adrecipient.DisplayName)) ? adrecipient.DisplayName : adrecipient.Name; mailboxAcePresentationObject.User = new SecurityPrincipalIdParameter(securityIdentifier, friendlyName); } } mailboxAcePresentationObject.ResetChangeTracking(true); base.WriteResult(mailboxAcePresentationObject); } num++; } } else { IdentityReference owner = activeDirectorySecurity.GetOwner(typeof(NTAccount)); OwnerPresentationObject dataObject2 = new OwnerPresentationObject(((ADUser)dataObject).Id, owner.ToString()); base.WriteResult(dataObject2); } } TaskLogger.LogExit(); }