private ResolvedGroup ResolveGroupInAD(object stateNotUsed, Tuple <PartitionId, OrganizationId, TGroupKeyType> tuple) { PartitionId item = tuple.Item1; OrganizationId item2 = tuple.Item2; TGroupKeyType item3 = tuple.Item3; IRecipientSession session = this.ReconstructRecipientSession(item, item2); IsMemberOfResolver <TGroupKeyType> .Tracer.TraceDebug <TGroupKeyType>((long)this.GetHashCode(), "Resolving group '{0}' in AD", item3); int count; ResolvedGroup result = this.adAdapter.ResolveGroup(session, item3, out count) ?? new ResolvedGroup(); this.perfCounters.IncrementLDAPQueryCount(count); return(result); }
public bool IsMemberOf(IRecipientSession session, Guid recipientObjectGuid, TGroupKeyType groupKey) { this.ThrowIfDisposed(); if (session == null) { throw new ArgumentNullException("session"); } if (this.enabled) { ResolvedGroup value = this.resolvedGroups.GetValue(null, new Tuple <PartitionId, OrganizationId, TGroupKeyType>(session.SessionSettings.PartitionId, session.SessionSettings.CurrentOrganizationId, groupKey)); if (value != null && value.GroupGuid != Guid.Empty) { return(this.IsMemberOf(session, recipientObjectGuid, value.GroupGuid)); } } return(false); }
public virtual ResolvedGroup ResolveGroup(IRecipientSession session, GroupKeyType group, out int ldapQueries) { if (session == null) { throw new ArgumentNullException("session"); } ResolvedGroup resolvedGroup = null; int numQueries = 0; this.RunADOperation(group, delegate { Guid groupGuid; Microsoft.Exchange.Data.Directory.Recipient.RecipientType recipientType; if (this.TryGetGroupInfo(session, group, out groupGuid, out recipientType, out numQueries) && this.IsGroup(recipientType)) { resolvedGroup = new ResolvedGroup(groupGuid); } }); ldapQueries = numQueries; return(resolvedGroup); }