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); } } }
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)); }); }
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); } }