// Token: 0x06000DED RID: 3565 RVA: 0x00029C98 File Offset: 0x00027E98 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { notFoundReason = new LocalizedString?(LocalizedString.Empty); EnumerableWrapper <T> enumerableWrapper = EnumerableWrapper <T> .Empty; SecurityIdentifier sid = SecurityPrincipalIdParameter.TryParseToSID(base.RawIdentity); string userAccountNameFromSid = SecurityPrincipalIdParameter.GetUserAccountNameFromSid(sid, this.ToString(), null); if (!string.IsNullOrEmpty(userAccountNameFromSid)) { enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, base.GetObjectsByAccountName <T>(userAccountNameFromSid, rootId, (IRecipientSession)session, optionalData)); if (enumerableWrapper.HasElements()) { return(enumerableWrapper); } } enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); if (enumerableWrapper.HasElements()) { return(enumerableWrapper); } sid = SecurityPrincipalIdParameter.GetUserSidAsSAMAccount(this, null, null); userAccountNameFromSid = SecurityPrincipalIdParameter.GetUserAccountNameFromSid(sid, this.ToString(), null); if (!string.IsNullOrEmpty(userAccountNameFromSid)) { enumerableWrapper = base.GetEnumerableWrapper <T>(EnumerableWrapper <T> .Empty, base.GetObjectsByAccountName <T>(userAccountNameFromSid, rootId, (IRecipientSession)session, optionalData)); } return(enumerableWrapper); }
// Token: 0x06000DEA RID: 3562 RVA: 0x00029A2C File Offset: 0x00027C2C internal static IADSecurityPrincipal GetSecurityPrincipal(IRecipientSession session, SecurityPrincipalIdParameter user, Task.TaskErrorLoggingDelegate logError, Task.TaskVerboseLoggingDelegate logVerbose) { if (session == null) { throw new ArgumentNullException("session"); } if (user == null) { throw new ArgumentNullException("user"); } if (logError == null) { throw new ArgumentNullException("logError"); } if (logVerbose == null) { throw new ArgumentNullException("logVerbose"); } ADRecipient adrecipient = null; logVerbose(Strings.CheckIfUserIsASID(user.ToString())); SecurityIdentifier securityIdentifier = SecurityPrincipalIdParameter.TryParseToSID(user.RawIdentity); if (null == securityIdentifier) { securityIdentifier = SecurityPrincipalIdParameter.GetUserSidAsSAMAccount(user, logError, logVerbose); } IEnumerable <ADRecipient> objects = user.GetObjects <ADRecipient>(null, session); foreach (ADRecipient adrecipient2 in objects) { if (adrecipient == null) { adrecipient = adrecipient2; } else { logError(new ManagementObjectAmbiguousException(Strings.ErrorUserNotUnique(user.ToString())), ErrorCategory.InvalidData, null); } } if (adrecipient == null && null != securityIdentifier) { adrecipient = new ADUser(); adrecipient.propertyBag.SetField(IADSecurityPrincipalSchema.Sid, securityIdentifier); } if (adrecipient == null) { logError(new ManagementObjectNotFoundException(Strings.ErrorUserNotFound(user.ToString())), ErrorCategory.InvalidData, null); } return((IADSecurityPrincipal)adrecipient); }
// Token: 0x06000DEB RID: 3563 RVA: 0x00029B48 File Offset: 0x00027D48 internal static SecurityIdentifier GetUserSid(IRecipientSession session, SecurityPrincipalIdParameter user, Task.TaskErrorLoggingDelegate logError, Task.TaskVerboseLoggingDelegate logVerbose) { if (session == null) { throw new ArgumentNullException("session"); } if (logError == null) { throw new ArgumentNullException("logError"); } if (logVerbose == null) { throw new ArgumentNullException("logVerbose"); } if (user == null) { throw new ArgumentNullException("user"); } logVerbose(Strings.CheckIfUserIsASID(user.ToString())); SecurityIdentifier securityIdentifier = SecurityPrincipalIdParameter.TryParseToSID(user.RawIdentity); if (null != securityIdentifier) { return(securityIdentifier); } logVerbose(Strings.LookupUserAsDomainUser(user.ToString())); IEnumerable <ADRecipient> objects = user.GetObjects <ADRecipient>(null, session); using (IEnumerator <ADRecipient> enumerator = objects.GetEnumerator()) { if (enumerator.MoveNext()) { securityIdentifier = ((IADSecurityPrincipal)enumerator.Current).Sid; if (enumerator.MoveNext()) { logError(new ManagementObjectAmbiguousException(Strings.ErrorUserNotUnique(user.ToString())), ErrorCategory.InvalidData, null); } return(securityIdentifier); } } securityIdentifier = SecurityPrincipalIdParameter.GetUserSidAsSAMAccount(user, logError, logVerbose); if (null == securityIdentifier) { logError(new ManagementObjectNotFoundException(Strings.ErrorUserNotFound(user.ToString())), ErrorCategory.InvalidData, null); } return(securityIdentifier); }