// Token: 0x06000A34 RID: 2612 RVA: 0x00021EB4 File Offset: 0x000200B4
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            IEnumerable <T>       enumerable        = null;
            EnumerableWrapper <T> enumerableWrapper = null;

            notFoundReason = null;
            if (string.IsNullOrEmpty(this.storageGroupName))
            {
                enumerableWrapper = EnumerableWrapper <T> .GetWrapper(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason));
            }
            if (!string.IsNullOrEmpty(base.CommonName) && (enumerableWrapper == null || !enumerableWrapper.HasElements()))
            {
                string            serverName        = this.storageGroupName;
                ServerIdParameter serverIdParameter = base.ServerId;
                if (string.IsNullOrEmpty(this.storageGroupName))
                {
                    serverName        = base.ServerName;
                    serverIdParameter = new ServerIdParameter();
                }
                ADObjectId[] matchingIdentities = serverIdParameter.GetMatchingIdentities((IConfigDataProvider)session);
                for (int i = 0; i < matchingIdentities.Length; i++)
                {
                    if (ServerIdParameter.HasRole(matchingIdentities[i], this.RoleRestriction, (IConfigDataProvider)session) || (base.AllowLegacy && !ServerIdParameter.HasRole(matchingIdentities[i], ServerRole.All, (IConfigDataProvider)session)))
                    {
                        if (string.IsNullOrEmpty(this.storageGroupName))
                        {
                            rootId     = matchingIdentities[i].GetChildId("InformationStore").GetChildId(serverName);
                            enumerable = base.PerformPrimarySearch <T>(base.CreateWildcardOrEqualFilter(ADObjectSchema.Name, base.CommonName), rootId, session, true, optionalData);
                        }
                        else
                        {
                            List <T> list = new List <T>();
                            IEnumerable <StorageGroup> enumerable2 = base.PerformSearch <StorageGroup>(base.CreateWildcardOrEqualFilter(ADObjectSchema.Name, this.storageGroupName), matchingIdentities[i], session, true);
                            foreach (StorageGroup storageGroup in enumerable2)
                            {
                                enumerable = base.PerformPrimarySearch <T>(base.CreateWildcardOrEqualFilter(ADObjectSchema.Name, base.CommonName), storageGroup.Id, session, true, optionalData);
                                list.AddRange(enumerable);
                            }
                            enumerable = list;
                        }
                    }
                }
            }
            else
            {
                enumerable = enumerableWrapper;
            }
            if (enumerable == null)
            {
                enumerable = new List <T>();
            }
            return(enumerable);
        }
Ejemplo n.º 2
0
        // Token: 0x06000A29 RID: 2601 RVA: 0x00021A8C File Offset: 0x0001FC8C
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            IEnumerable <T> enumerable = null;
            List <T>        list       = new List <T>();

            notFoundReason = null;
            int num  = 0;
            int num2 = 0;

            if (base.InternalADObjectId != null)
            {
                enumerable = base.GetADObjectIdObjects <T>(base.InternalADObjectId, rootId, subTreeSession, optionalData);
            }
            EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(enumerable);

            if (wrapper.HasElements())
            {
                using (IEnumerator <T> enumerator = wrapper.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        T item = enumerator.Current;
                        if (ServerIdParameter.HasRole((ADObjectId)item.Identity, this.RoleRestriction, (IConfigDataProvider)session) || (this.AllowLegacy && !ServerIdParameter.HasRole((ADObjectId)item.Identity, ServerRole.All, (IConfigDataProvider)session)))
                        {
                            list.Add(item);
                        }
                        else if (!ServerIdParameter.HasRole((ADObjectId)item.Identity, ServerRole.All, (IConfigDataProvider)session))
                        {
                            num2++;
                        }
                        else
                        {
                            num++;
                        }
                    }
                    goto IL_21B;
                }
            }
            if (!string.IsNullOrEmpty(this.CommonName) && this.ServerId != null)
            {
                ADObjectId[] matchingIdentities = this.ServerId.GetMatchingIdentities((IConfigDataProvider)session);
                foreach (ADObjectId rootId2 in matchingIdentities)
                {
                    enumerable = base.GetObjectsInOrganization <T>(this.CommonName, rootId2, session, optionalData);
                    foreach (T item2 in enumerable)
                    {
                        if (ServerIdParameter.HasRole((ADObjectId)item2.Identity, this.RoleRestriction, (IConfigDataProvider)session) || (this.AllowLegacy && !ServerIdParameter.HasRole((ADObjectId)item2.Identity, ServerRole.All, (IConfigDataProvider)session)))
                        {
                            list.Add(item2);
                        }
                        else if (!ServerIdParameter.HasRole((ADObjectId)item2.Identity, ServerRole.All, (IConfigDataProvider)session))
                        {
                            num2++;
                        }
                        else
                        {
                            num++;
                        }
                    }
                }
            }
IL_21B:
            if (list.Count == 0)
            {
                if (num2 != 0)
                {
                    notFoundReason = new LocalizedString?(Strings.ExceptionLegacyObjects(this.ToString()));
                }
                if (num != 0)
                {
                    notFoundReason = new LocalizedString?(Strings.ExceptionRoleNotFoundObjects(this.ToString()));
                }
            }
            return(list);
        }