private void WriteRawRules() { ADRuleStorageManager ruleStorageManager = base.RuleStorageManager; using (Stream stream = new MemoryStream()) { using (StreamWriter streamWriter = new StreamWriter(stream)) { ruleStorageManager.LoadRuleCollectionWithoutParsing(); ruleStorageManager.WriteRawRulesToStream(streamWriter); if (base.NeedSuppressingPiiData) { stream.Seek(0L, SeekOrigin.Begin); StreamReader streamReader = new StreamReader(stream); string value = SuppressingPiiData.Redact(streamReader.ReadToEnd()); stream.SetLength(0L); streamWriter.Write(value); streamWriter.Flush(); } stream.Seek(0L, SeekOrigin.Begin); using (BinaryReader binaryReader = new BinaryReader(stream)) { BinaryFileDataObject dataObject = new BinaryFileDataObject { FileData = binaryReader.ReadBytes((int)binaryReader.BaseStream.Length) }; this.WriteResult(dataObject); } } } }
public void Supress(object dataObject) { if (!this.SuppressPiiEnabled) { return; } Type type = dataObject.GetType(); List <PiiProcessor.PiiProperty> piiProperties = this.GetPiiProperties(type); foreach (PiiProcessor.PiiProperty piiProperty in piiProperties) { string text = (string)piiProperty.PropertyInfo.GetValue(dataObject, null); if (piiProperty.PiiDataType == PiiDataType.Smtp) { piiProperty.PropertyInfo.SetValue(dataObject, SuppressingPiiData.RedactSmtpAddress(text), null); } else { if (piiProperty.PiiDataType != PiiDataType.String) { throw new NotSupportedException("Unsupported PII data type: " + piiProperty.PiiDataType); } piiProperty.PropertyInfo.SetValue(dataObject, SuppressingPiiData.Redact(text), null); } } }
private IdentityDetails[] GetIdentityDetails(Result <ADRawEntry>[] queryResults, object[] ids) { List <IdentityDetails> list = new List <IdentityDetails>(queryResults.Length); for (int i = 0; i < queryResults.Length; i++) { Result <ADRawEntry> result = queryResults[i]; if (result.Error != null) { this.WriteWarning(Strings.WarningUnableToResolveUser(ids[i].ToString(), result.Error.ToString())); } else if (result.Data == null) { this.WriteWarning(Strings.WarningUnableToResolveUser(ids[i].ToString(), string.Empty)); } else { IdentityDetails identityDetails = new IdentityDetails(result.Data); if (base.NeedSuppressingPiiData) { identityDetails = SuppressingPiiData.Redact(identityDetails); } list.Add(identityDetails); } } return(list.ToArray()); }
internal override void SuppressPiiData() { string text; string text2; this.ReportDestination = SuppressingPiiData.Redact(this.ReportDestination, out text, out text2); }
internal override void SuppressPiiData() { string[] array; string[] array2; this.Addresses = SuppressingPiiData.Redact(this.Addresses, out array, out array2); this.Addresses2 = SuppressingPiiData.Redact(this.Addresses2, out array, out array2); }
private string SuppressPiiDataAsNeeded(string value) { if (base.NeedSuppressingPiiData && value != null) { return(SuppressingPiiData.Redact(value)); } return(value); }
internal static void RedactBinding(BindingMetadata binding, bool redactImmutableId) { binding.DisplayName = SuppressingPiiData.Redact(binding.DisplayName); binding.Name = SuppressingPiiData.Redact(binding.Name); if (redactImmutableId) { binding.ImmutableIdentity = SuppressingPiiData.Redact(binding.ImmutableIdentity); } }
public static string RedactRoutingAddressIfNecessary(RoutingAddress address, bool isNecessary) { ArgumentValidator.ThrowIfNullOrEmpty("address.ToString()", address.ToString()); if (isNecessary) { return(SuppressingPiiData.Redact(address).ToString()); } return(address.ToString()); }
private MailboxFolder RedactMailboxFolder(MailboxFolder folder) { folder.Name = SuppressingPiiData.Redact(folder.Name); string text; string text2; folder.FolderPath = SuppressingPiiData.Redact(folder.FolderPath, out text, out text2); folder.MailboxOwnerId = SuppressingPiiData.Redact(folder.MailboxOwnerId, out text, out text2); return(folder); }
static RedactAttribute() { RedactAttribute.redactionFunctions.Add(typeof(string), delegate(PropertyInfo property, object propertyInstance) { RedactAttribute.Redact(property, propertyInstance, (string value) => SuppressingPiiData.Redact(value)); }); RedactAttribute.redactionFunctions.Add(typeof(SmtpAddress), delegate(PropertyInfo property, object propertyInstance) { RedactAttribute.Redact(property, propertyInstance, (string value) => SuppressingPiiData.RedactSmtpAddress(value)); }); }
private AADUserPresentationObject Redact(AADUserPresentationObject value) { if (value != null) { value.DisplayName = SuppressingPiiData.Redact(value.DisplayName); value.MailNickname = SuppressingPiiData.Redact(value.MailNickname); value.Owners = this.Redact(value.Owners); value.Members = this.Redact(value.Members); } return(value); }
internal void Redact() { string text; string text2; this.SharepointTenantAdminUrl = SuppressingPiiData.Redact(this.SharepointTenantAdminUrl, out text, out text2); this.SharepointRootSiteUrl = SuppressingPiiData.Redact(this.SharepointRootSiteUrl, out text, out text2); foreach (string key in this.prerequisiteDictionary.Keys.ToList <string>()) { this.prerequisiteDictionary[key] = SuppressingPiiData.Redact(this.prerequisiteDictionary[key]); } }
internal static SmtpAddress RedactPiiSmtpAddress(SmtpAddress original, Task context) { if (SmtpAddress.Empty == original) { return(original); } string original2; string redacted; SmtpAddress result = SuppressingPiiData.Redact(original, out original2, out redacted); Utils.AddPiiToMap(context.ExchangeRunspaceConfig, original2, redacted); return(result); }
internal static string RedactPiiString(string original, Task context) { if (string.IsNullOrEmpty(original)) { return(original); } string original2; string redacted; string result = SuppressingPiiData.Redact(original, out original2, out redacted); Utils.AddPiiToMap(context.ExchangeRunspaceConfig, original2, redacted); return(result); }
public UMMailboxPin(ADUser user, bool expired, bool lockedOut, bool firstTimeUser, bool needSuppressingPiiData) { this.userObjectId = user.Identity; this.userId = user.PrimarySmtpAddress.ToString(); this.pinExpired = expired; this.lockedOut = lockedOut; this.isFirstTimeUser = firstTimeUser; if (needSuppressingPiiData) { ADObjectId id = user.Id; string text; string text2; this.userObjectId = SuppressingPiiData.Redact(id, out text, out text2); this.userId = SuppressingPiiData.RedactSmtpAddress(this.userId); } }
private AADGroupPresentationObject Redact(AADGroupPresentationObject value) { if (value != null) { value.AllowAccessTo = this.Redact(value.AllowAccessTo); value.Description = SuppressingPiiData.Redact(value.Description); value.DisplayName = SuppressingPiiData.Redact(value.DisplayName); value.ExchangeResources = SuppressingPiiData.Redact(value.ExchangeResources); value.Mail = SuppressingPiiData.Redact(value.Mail); value.PendingMembers = this.Redact(value.PendingMembers); value.ProxyAddresses = SuppressingPiiData.Redact(value.ProxyAddresses); value.SharePointResources = SuppressingPiiData.Redact(value.SharePointResources); value.Owners = this.Redact(value.Owners); value.Members = this.Redact(value.Members); } return(value); }
private IdentityDetails[] GetIdentityDetails(ADRawEntry[] adRawEntries) { List <IdentityDetails> list = new List <IdentityDetails>(adRawEntries.Length); for (int i = 0; i < adRawEntries.Length; i++) { if (adRawEntries[i] != null) { IdentityDetails identityDetails = new IdentityDetails(adRawEntries[i]); if (base.NeedSuppressingPiiData) { identityDetails = SuppressingPiiData.Redact(identityDetails); } list.Add(identityDetails); } } return(list.ToArray()); }
protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject) { IConfigurable configurable = base.ConvertDataObjectToPresentationObject(dataObject); Mailbox mailbox = configurable as Mailbox; if (mailbox == null) { return(null); } TenantPublicFolderConfiguration value = TenantPublicFolderConfigurationCache.Instance.GetValue(mailbox.OrganizationId); bool flag = mailbox.RecipientTypeDetails == Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails.PublicFolderMailbox; if (!flag) { if (mailbox.DefaultPublicFolderMailboxValue == null || mailbox.DefaultPublicFolderMailboxValue.IsDeleted) { PublicFolderRecipient publicFolderRecipient = value.GetPublicFolderRecipient(mailbox.ExchangeGuid, null); if (publicFolderRecipient != null) { if (base.NeedSuppressingPiiData) { string text; string text2; mailbox.DefaultPublicFolderMailbox = SuppressingPiiData.Redact(publicFolderRecipient.ObjectId, out text, out text2); } else { mailbox.DefaultPublicFolderMailbox = publicFolderRecipient.ObjectId; } } } else { mailbox.DefaultPublicFolderMailbox = mailbox.DefaultPublicFolderMailboxValue; } } mailbox.IsRootPublicFolderMailbox = (flag && value.GetHierarchyMailboxInformation().HierarchyMailboxGuid == mailbox.ExchangeGuid); if (this.UsnForReconciliationSearch >= 0L) { mailbox.ReconciliationId = mailbox.NetID; } mailbox.ResetChangeTracking(); return(mailbox); }
private IEnumerable <PublicFolderItemStatistics> FindItems(PublicFolder publicFolder) { PropertyDefinition[] xsoProperties = PublicFolderItemStatistics.StaticSchema.AllDependentXsoProperties; PublicFolderSession publicFolderContentSession = null; if (this.mailboxGuid == Guid.Empty) { publicFolderContentSession = this.publicFolderDataProvider.PublicFolderSessionCache.GetPublicFolderSession(publicFolder.InternalFolderIdentity.ObjectId); } else { publicFolderContentSession = this.publicFolderDataProvider.PublicFolderSessionCache.GetPublicFolderSession(this.mailboxGuid); } using (Folder xsoFolder = Folder.Bind(publicFolderContentSession, publicFolder.InternalFolderIdentity)) { using (QueryResult itemQueryResult = xsoFolder.ItemQuery(ItemQueryType.None, null, GetPublicFolderItemStatistics.sortByProperties, xsoProperties)) { for (;;) { object[][] rowResults = itemQueryResult.GetRows(100); if (rowResults == null || rowResults.Length <= 0) { break; } foreach (object[] row in rowResults) { PublicFolderItemStatistics itemStatistics = new PublicFolderItemStatistics(); itemStatistics.LoadDataFromXsoRows(publicFolderContentSession.MailboxPrincipal.ObjectId, row, xsoProperties); if (base.NeedSuppressingPiiData) { itemStatistics.PublicFolderName = SuppressingPiiData.Redact(this.Identity.ToString()); } else { itemStatistics.PublicFolderName = this.Identity.ToString(); } yield return(itemStatistics); } } } } yield break; }
protected override void WriteResult(IConfigurable dataObject) { PublicFolder publicFolder = (PublicFolder)dataObject; TenantPublicFolderConfiguration value = TenantPublicFolderConfigurationCache.Instance.GetValue(base.CurrentOrganizationId); if (value != null) { if (value.GetLocalMailboxRecipient(publicFolder.ContentMailboxGuid) == null) { TenantPublicFolderConfigurationCache.Instance.RemoveValue(base.CurrentOrganizationId); value = TenantPublicFolderConfigurationCache.Instance.GetValue(base.CurrentOrganizationId); } PublicFolderRecipient localMailboxRecipient = value.GetLocalMailboxRecipient(publicFolder.ContentMailboxGuid); publicFolder.ContentMailboxName = ((localMailboxRecipient != null) ? localMailboxRecipient.MailboxName : string.Empty); if (base.NeedSuppressingPiiData) { publicFolder.ContentMailboxName = SuppressingPiiData.Redact(publicFolder.ContentMailboxName); } publicFolder.ResetChangeTracking(); } base.WriteResult(publicFolder); }
private void WriteMailboxAssociation(MailboxAssociationFromStore association, IAssociationAdaptor associationAdaptor, ADUser masterMailbox, IExtensibleLogger logger) { if (association != null) { ObjectId objectId = new MailboxStoreObjectId(masterMailbox.ObjectId, association.ItemId.ObjectId); MailboxLocator slaveMailboxLocator = associationAdaptor.GetSlaveMailboxLocator(association); if (base.NeedSuppressingPiiData) { objectId = SuppressingPiiData.RedactMailboxStoreObjectId(objectId); } base.WriteResult(new MailboxAssociationPresentationObject { Identity = objectId, ExternalId = slaveMailboxLocator.ExternalId, LegacyDn = slaveMailboxLocator.LegacyDn, IsMember = association.IsMember, JoinedBy = association.JoinedBy, GroupSmtpAddress = association.GroupSmtpAddress, UserSmtpAddress = association.UserSmtpAddress, IsPin = association.IsPin, ShouldEscalate = association.ShouldEscalate, IsAutoSubscribed = association.IsAutoSubscribed, JoinDate = association.JoinDate, LastVisitedDate = association.LastVisitedDate, PinDate = association.PinDate, LastModified = association.LastModified, CurrentVersion = association.CurrentVersion, SyncedVersion = association.SyncedVersion, LastSyncError = association.LastSyncError, SyncAttempts = association.SyncAttempts, SyncedSchemaVersion = association.SyncedSchemaVersion }); return; } GetMailboxAssociation.Tracer.TraceDebug((long)this.GetHashCode(), "GetMailboxAssocaition.WriteMailboxAssociation. Skipping null MailboxAssociationFromStore."); }
internal void SuppressPiiData() { this.value = SuppressingPiiData.Redact(this.value); }
internal override void SuppressPiiData() { string[] array; string[] array2; this.Words = SuppressingPiiData.Redact(this.Words, out array, out array2); }
public void Redact() { this.Endpoint = SuppressingPiiData.Redact(this.Endpoint); }
protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject) { if (dataObject == null) { return(null); } ADUser aduser = (ADUser)dataObject; IRecipientSession recipientSession = (IRecipientSession)base.DataSession; GroupMailbox groupMailbox = GroupMailbox.FromDataObject(aduser); if ((this.IncludeMemberSyncStatus || this.IncludePermissionsVersion) && CmdletProxy.TryToProxyOutputObject(groupMailbox, base.CurrentTaskContext, aduser, false, this.ConfirmationMessage, CmdletProxy.AppendIdentityToProxyCmdlet(aduser))) { return(groupMailbox); } ExchangePrincipal exchangePrincipal = null; if (this.IncludeMailboxUrls) { try { exchangePrincipal = ExchangePrincipal.FromADUser(aduser, RemotingOptions.AllowCrossSite); MailboxUrls mailboxUrls = new MailboxUrls(exchangePrincipal, false); groupMailbox.InboxUrl = this.SuppressPiiDataAsNeeded(mailboxUrls.InboxUrl); groupMailbox.CalendarUrl = this.SuppressPiiDataAsNeeded(mailboxUrls.CalendarUrl); groupMailbox.PeopleUrl = this.SuppressPiiDataAsNeeded(mailboxUrls.PeopleUrl); groupMailbox.PhotoUrl = this.SuppressPiiDataAsNeeded(mailboxUrls.PhotoUrl); } catch (LocalizedException ex) { base.WriteWarning("Unable to get mailbox principal due exception: " + ex.Message); } } IdentityDetails[] ownersDetails = this.GetOwnersDetails(recipientSession, aduser); if (ownersDetails != null) { groupMailbox.OwnersDetails = ownersDetails; } ADRawEntry[] array = null; if (this.IncludeMembers) { array = this.GetMemberRawEntriesFromAD(recipientSession, aduser); IdentityDetails[] identityDetails = this.GetIdentityDetails(array); groupMailbox.MembersDetails = identityDetails; groupMailbox.Members = Array.ConvertAll <IdentityDetails, ADObjectId>(identityDetails, (IdentityDetails member) => member.Identity); } if (!this.IncludeMemberSyncStatus) { if (!this.IncludePermissionsVersion) { return(groupMailbox); } } try { if (exchangePrincipal == null) { exchangePrincipal = ExchangePrincipal.FromADUser(aduser, RemotingOptions.AllowCrossSite); } using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(exchangePrincipal, CultureInfo.InvariantCulture, "Client=Management;Action=Get-GroupMailbox")) { if (this.IncludeMemberSyncStatus) { if (array == null) { array = this.GetMemberRawEntriesFromAD(recipientSession, aduser); } ADObjectId[] membersInAD = Array.ConvertAll <ADRawEntry, ADObjectId>(array, (ADRawEntry member) => member.Id); ADObjectId[] membersFromMailbox = this.GetMembersFromMailbox(recipientSession, aduser, mailboxSession); groupMailbox.MembersSyncStatus = new GroupMailboxMembersSyncStatus(membersInAD, membersFromMailbox); if (base.NeedSuppressingPiiData) { groupMailbox.MembersSyncStatus.MembersInADOnly = SuppressingPiiData.Redact(groupMailbox.MembersSyncStatus.MembersInADOnly); groupMailbox.MembersSyncStatus.MembersInMailboxOnly = SuppressingPiiData.Redact(groupMailbox.MembersSyncStatus.MembersInMailboxOnly); } } if (this.IncludePermissionsVersion) { groupMailbox.PermissionsVersion = mailboxSession.Mailbox.GetValueOrDefault <int>(MailboxSchema.GroupMailboxPermissionsVersion, 0).ToString(); } } } catch (LocalizedException ex2) { base.WriteWarning("Unable to retrieve data from group mailbox due exception: " + ex2.Message); } return(groupMailbox); }