Exemplo n.º 1
0
        internal override IEnumerable <T> GetObjectsInOrganization <T>(string identityString, ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData)
        {
            IConfigurationSession scSession = session as IConfigurationSession;

            string[]              commonNames = AddressListIdParameter.GetCommonNames(identityString);
            ADObjectId            identity    = this.ResolveAddressListId(AddressListIdParameter.GetRootContainerId(scSession), commonNames);
            EnumerableWrapper <T> wrapper     = EnumerableWrapper <T> .GetWrapper(base.GetADObjectIdObjects <T>(identity, rootId, session, optionalData));

            if (wrapper.HasElements())
            {
                return(wrapper);
            }
            wrapper = EnumerableWrapper <T> .GetWrapper(base.GetObjectsInOrganization <T>(identityString, rootId, session, optionalData));

            if (wrapper.HasElements() || commonNames.Length == 1 || !identityString.Contains("*"))
            {
                return(wrapper);
            }
            Queue <ADObjectId> queue = new Queue <ADObjectId>();

            queue.Enqueue(rootId ?? AddressListIdParameter.GetRootContainerId(scSession));
            for (int i = 0; i < commonNames.Length - 1; i++)
            {
                Queue <ADObjectId> queue2 = new Queue <ADObjectId>();
                string             name   = commonNames[i];
                foreach (ADObjectId rootId2 in queue)
                {
                    QueryFilter     filter     = base.CreateWildcardOrEqualFilter(ADObjectSchema.Name, name);
                    IEnumerable <T> enumerable = this.PerformSearch <T>(filter, rootId2, session, false);
                    foreach (T t in enumerable)
                    {
                        queue2.Enqueue((ADObjectId)t.Identity);
                    }
                }
                queue = queue2;
            }
            string name2 = commonNames[commonNames.Length - 1];
            List <IEnumerable <T> > list = new List <IEnumerable <T> >();

            foreach (ADObjectId rootId3 in queue)
            {
                QueryFilter     filter2 = base.CreateWildcardOrEqualFilter(ADObjectSchema.Name, name2);
                IEnumerable <T> item    = base.PerformPrimarySearch <T>(filter2, rootId3, session, false, optionalData);
                list.Add(item);
            }
            return(EnumerableWrapper <T> .GetWrapper(list));
        }
Exemplo n.º 2
0
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            if (typeof(T) != typeof(AddressBookBase))
            {
                throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type");
            }
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            IConfigurationSession scSession = session as IConfigurationSession;

            if ("\\" == base.RawIdentity)
            {
                notFoundReason = null;
                ADObjectId rootContainerId = AddressListIdParameter.GetRootContainerId(scSession);
                return(EnumerableWrapper <T> .GetWrapper(base.GetADObjectIdObjects <T>(rootContainerId, rootId, subTreeSession, optionalData), this.GetEnumerableFilter <T>()));
            }
            return(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason));
        }
Exemplo n.º 3
0
 internal static ADObjectId GetRootContainerId(IConfigurationSession scSession)
 {
     return(AddressListIdParameter.GetRootContainerId(scSession, null));
 }