// Token: 0x06000DD9 RID: 3545 RVA: 0x0002969C File Offset: 0x0002789C
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            if (typeof(T) != typeof(ReducedRecipient))
            {
                throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type");
            }
            OptionalIdentityData optionalIdentityData;

            if (optionalData == null)
            {
                optionalIdentityData = new OptionalIdentityData();
            }
            else
            {
                optionalIdentityData = optionalData.Clone();
            }
            RoleGroupIdParameter @object = new RoleGroupIdParameter(base.RawIdentity);
            ADGroup object2 = base.GetObject <ADGroup>(rootId, session, subTreeSession, optionalIdentityData, new RecipientIdParameter.GetObjectsDelegate <ADGroup>(@object.GetObjects <ADGroup>), out notFoundReason);

            if (object2 == null)
            {
                return(EnumerableWrapper <T> .Empty);
            }
            optionalIdentityData.RootOrgDomainContainerId = null;
            IDirectorySession directorySession        = TaskHelper.UnderscopeSessionToOrganization(session, object2.OrganizationId, true);
            IDirectorySession reducedRecipientSession = DirectorySessionFactory.Default.GetReducedRecipientSession((IRecipientSession)directorySession, 160, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\RecipientParameters\\RoleGroupMemberIdParameter.cs");
            QueryFilter       filter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MemberOfGroup, object2.Id);

            return(base.PerformPrimarySearch <T>(filter, null, reducedRecipientSession, true, optionalIdentityData));
        }
Esempio n. 2
0
        private IEnumerable <T> GetMultitenancyObjects <T>(string identityString, ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) where T : IConfigurable, new()
        {
            if (identityString == null)
            {
                throw new ArgumentNullException("rawIdentity");
            }
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            notFoundReason = null;
            string text;
            string identityString2;

            if (!this.IsMultitenancyEnabled() || !this.TryParseOrganizationName(out text, out identityString2))
            {
                return(EnumerableWrapper <T> .Empty);
            }
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(session.DomainController, true, session.ConsistencyMode, session.NetworkCredential, session.SessionSettings, 1403, "GetMultitenancyObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\ADIdParameter.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC          = true;
            tenantOrTopologyConfigurationSession.LinkResolutionServer = session.LinkResolutionServer;
            if (!string.IsNullOrEmpty(session.DomainController) && tenantOrTopologyConfigurationSession.SessionSettings.CurrentOrganizationId.Equals(OrganizationId.ForestWideOrgId) && tenantOrTopologyConfigurationSession.SessionSettings.PartitionId.ForestFQDN != TopologyProvider.LocalForestFqdn)
            {
                return(EnumerableWrapper <T> .Empty);
            }
            if (this.IsWildcardDefined(text))
            {
                notFoundReason = new LocalizedString?(Strings.ErrorOrganizationWildcard);
                return(EnumerableWrapper <T> .Empty);
            }
            OrganizationId organizationId;

            if (this.orgIdResolved)
            {
                organizationId = this.resolvedOrganizationId;
            }
            else
            {
                organizationId = this.GetOrganizationId(session.SessionSettings.CurrentOrganizationId, text);
            }
            IDirectorySession directorySession = session;

            if (organizationId != null && !OrganizationId.ForestWideOrgId.Equals(organizationId) && session.SessionSettings != null && session.SessionSettings.CurrentOrganizationId.Equals(OrganizationId.ForestWideOrgId))
            {
                directorySession = TaskHelper.UnderscopeSessionToOrganization(session, organizationId, true);
            }
            if (organizationId != null && !OrganizationId.ForestWideOrgId.Equals(organizationId) && organizationId.Equals(directorySession.SessionSettings.CurrentOrganizationId))
            {
                IEnumerable <T> objectsInOrganization = this.GetObjectsInOrganization <T>(identityString2, rootId, directorySession, optionalData);
                return(EnumerableWrapper <T> .GetWrapper(objectsInOrganization));
            }
            return(EnumerableWrapper <T> .Empty);
        }
Esempio n. 3
0
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            DistributionGroupIdParameter @object = new DistributionGroupIdParameter(base.RawIdentity);
            ReducedRecipient             object2 = base.GetObject <ReducedRecipient>(rootId, session, subTreeSession, optionalData, new RecipientIdParameter.GetObjectsDelegate <ReducedRecipient>(@object.GetObjects <ReducedRecipient>), out notFoundReason);

            if (object2 == null)
            {
                return(EnumerableWrapper <T> .Empty);
            }
            if (object2.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox || object2.RecipientTypeDetails == RecipientTypeDetails.RemoteGroupMailbox)
            {
                throw new ArgumentException(Strings.WrongTypeMailboxRecipient(object2.Id.ToString()));
            }
            IDirectorySession directorySession        = TaskHelper.UnderscopeSessionToOrganization(session, object2.OrganizationId, true);
            IDirectorySession reducedRecipientSession = DirectorySessionFactory.Default.GetReducedRecipientSession((IRecipientSession)directorySession, 155, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\RecipientParameters\\DistributionGroupMemberIdParameter.cs");
            QueryFilter       filter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MemberOfGroup, object2.Id);

            return(base.PerformPrimarySearch <T>(filter, null, reducedRecipientSession, true, optionalData));
        }
Esempio n. 4
0
        protected void UnderscopeDataSession(OrganizationId orgId)
        {
            IDirectorySession session = (IDirectorySession)this.dataSession;

            this.dataSession = (IConfigDataProvider)TaskHelper.UnderscopeSessionToOrganization(session, orgId, this.RehomeDataSession);
        }
Esempio n. 5
0
 // Token: 0x060006FD RID: 1789 RVA: 0x0001A435 File Offset: 0x00018635
 internal static IDirectorySession UnderscopeSessionToOrganization(IDirectorySession session, OrganizationId orgId, bool rehomeDataSession = true)
 {
     return(TaskHelper.UnderscopeSessionToOrganization(session, orgId, null, rehomeDataSession));
 }
Esempio n. 6
0
        // Token: 0x060005C3 RID: 1475 RVA: 0x00015CAC File Offset: 0x00013EAC
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            OrganizationId currentOrganizationId = base.CurrentOrganizationId;
            TDataObject    dataObject            = this.DataObject;

            if (!currentOrganizationId.Equals(dataObject.OrganizationId))
            {
                this.CurrentOrgState = new LazilyInitialized <SharedTenantConfigurationState>(delegate()
                {
                    TDataObject dataObject17 = this.DataObject;
                    return(SharedConfiguration.GetSharedConfigurationState(dataObject17.OrganizationId));
                });
            }
            ADRecipient adrecipient = this.DataObject;
            bool        flag        = adrecipient != null && adrecipient.RecipientSoftDeletedStatus > 0;

            if (RecipientTaskHelper.IsMailEnabledRecipientType(this.DesiredRecipientType) && !flag)
            {
                if (!base.IsProvisioningLayerAvailable)
                {
                    base.WriteError(new InvalidOperationException(Strings.ErrorNoProvisioningHandlerAvailable), (ErrorCategory)1001, null);
                }
                TDataObject dataObject2 = this.DataObject;
                if (dataObject2.IsModified(ADRecipientSchema.EmailAddresses))
                {
                    TDataObject dataObject3 = this.DataObject;
                    if (dataObject3.EmailAddresses.Count > 0)
                    {
                        if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && this.ShouldCheckAcceptedDomains())
                        {
                            IDirectorySession     configurationSession  = this.ConfigurationSession;
                            TDataObject           dataObject4           = this.DataObject;
                            IConfigurationSession configurationSession2 = (IConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(configurationSession, dataObject4.OrganizationId, true);
                            IConfigurationSession cfgSession            = configurationSession2;
                            TDataObject           dataObject5           = this.DataObject;
                            RecipientTaskHelper.ValidateSmtpAddress(cfgSession, dataObject5.EmailAddresses, this.DataObject, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache);
                        }
                        ADObjectId        rootOrgContainerId = base.RootOrgContainerId;
                        TDataObject       dataObject6        = this.DataObject;
                        ADSessionSettings sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, dataObject6.OrganizationId, base.ExecutingUserOrganizationId, false);
                        IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, string.IsNullOrEmpty(base.DomainController) ? null : base.NetCredential, sessionSettings, 557, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\SetAdObjectTask.cs");
                        IRecipientSession tenantCatalogSession            = tenantOrRootOrgRecipientSession;
                        TDataObject       dataObject7 = this.DataObject;
                        RecipientTaskHelper.ValidateEmailAddressErrorOut(tenantCatalogSession, dataObject7.EmailAddresses, this.DataObject, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerReThrowDelegate(this.WriteError));
                    }
                }
            }
            TDataObject dataObject8 = this.DataObject;

            if (dataObject8.IsChanged(ADObjectSchema.Id))
            {
                IDirectorySession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, base.OrgWideSessionSettings, ConfigScopes.TenantSubTree, 579, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\SetAdObjectTask.cs");
                tenantOrTopologyConfigurationSession.UseConfigNC = ((IDirectorySession)base.DataSession).UseConfigNC;
                TDataObject dataObject9 = this.DataObject;
                ADObjectId  parent      = dataObject9.Id.Parent;
                ADRawEntry  adrawEntry  = tenantOrTopologyConfigurationSession.ReadADRawEntry(parent, new PropertyDefinition[]
                {
                    ADObjectSchema.ExchangeVersion
                });
                ExchangeObjectVersion exchangeObjectVersion = (ExchangeObjectVersion)adrawEntry[ADObjectSchema.ExchangeVersion];
                TDataObject           dataObject10          = this.DataObject;
                if (dataObject10.ExchangeVersion.IsOlderThan(exchangeObjectVersion))
                {
                    TDataObject dataObject11 = this.DataObject;
                    string      name         = dataObject11.Name;
                    TDataObject dataObject12 = this.DataObject;
                    base.WriteError(new TaskException(Strings.ErrorParentHasNewerVersion(name, dataObject12.ExchangeVersion.ToString(), exchangeObjectVersion.ToString())), (ErrorCategory)1004, null);
                }
            }
            TDataObject dataObject13 = this.DataObject;

            if (dataObject13.RecipientType != this.DesiredRecipientType && this.DesiredRecipientType != RecipientType.Invalid)
            {
                TDataObject   dataObject14 = this.DataObject;
                string        id           = dataObject14.Identity.ToString();
                string        oldType      = this.DesiredRecipientType.ToString();
                TDataObject   dataObject15 = this.DataObject;
                Exception     exception    = new InvalidOperationException(Strings.ErrorSetTaskChangeRecipientType(id, oldType, dataObject15.RecipientType.ToString()));
                ErrorCategory category     = (ErrorCategory)1000;
                TDataObject   dataObject16 = this.DataObject;
                base.WriteError(exception, category, dataObject16.Identity);
            }
            base.InternalProcessRecord();
            TaskLogger.LogExit();
        }
Esempio n. 7
0
        internal IEnumerable <T> GetADObjectIdObjects <T>(ADObjectId identity, ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData) where T : IConfigurable, new()
        {
            if (identity != null)
            {
                OrganizationId organizationId;
                if (this.InternalADObjectId != null && this.InternalADObjectId.Equals(identity) && this.orgIdResolved)
                {
                    organizationId = this.resolvedOrganizationId;
                }
                else
                {
                    organizationId = this.GetOrganizationId(session.SessionSettings.CurrentOrganizationId, identity);
                }
                IDirectorySession directorySession = session;
                if (organizationId != null)
                {
                    directorySession = TaskHelper.UnderscopeSessionToOrganization(session, organizationId, true);
                }
                if (session.ConfigScope == ConfigScopes.TenantSubTree)
                {
                    directorySession = ADSession.RescopeSessionToTenantSubTree(directorySession);
                }
                if (directorySession.IsRootIdWithinScope <T>(rootId))
                {
                    if (ADObjectId.Equals(identity, identity.DomainId) && !typeof(OrganizationalUnitIdParameterBase).IsAssignableFrom(base.GetType()))
                    {
                        if (!typeof(ADRawEntryIdParameter).IsAssignableFrom(base.GetType()))
                        {
                            goto IL_15F;
                        }
                    }
                    try
                    {
                        ADObjectId rootId2 = rootId;
                        bool       enforceContainerizedScoping = directorySession.EnforceContainerizedScoping;
                        bool       flag = directorySession is IRecipientSession;
                        if (rootId == null && !string.IsNullOrEmpty(identity.DistinguishedName))
                        {
                            if (!ADObjectId.Equals(identity, identity.DomainId) && directorySession.IsRootIdWithinScope <T>(identity.Parent))
                            {
                                rootId2 = identity.Parent;
                            }
                            else if (directorySession.IsRootIdWithinScope <T>(identity))
                            {
                                rootId2 = identity;
                                if (flag)
                                {
                                    directorySession.EnforceContainerizedScoping = false;
                                }
                            }
                        }
                        try
                        {
                            EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(this.PerformPrimarySearch <T>(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, identity), rootId2, directorySession, true, optionalData));

                            if (wrapper.HasElements())
                            {
                                return(wrapper);
                            }
                        }
                        finally
                        {
                            if (flag)
                            {
                                directorySession.EnforceContainerizedScoping = enforceContainerizedScoping;
                            }
                        }
                    }
                    catch (LocalizedException exception)
                    {
                        if (!TaskHelper.IsTaskKnownException(exception))
                        {
                            throw;
                        }
                    }
IL_15F:
                    if (identity.ObjectGuid != Guid.Empty)
                    {
                        return(this.PerformPrimarySearch <T>(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Guid, identity.ObjectGuid), rootId, directorySession, true, optionalData));
                    }
                }
            }
            return(EnumerableWrapper <T> .Empty);
        }