protected override IConfigDataProvider CreateSession()
        {
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
            ADSessionSettings adsessionSettings  = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            this.currentOrgConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, null, adsessionSettings, 313, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            adsessionSettings            = ADSessionSettings.RescopeToSubtree(adsessionSettings);
            if (MapiTaskHelper.IsDatacenter || MapiTaskHelper.IsDatacenterDedicated)
            {
                adsessionSettings.IncludeSoftDeletedObjects = true;
                adsessionSettings.IncludeInactiveMailbox    = true;
            }
            this.gcSession     = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 330, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            this.recipSession  = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 337, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            this.configSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromRootOrgScopeSet(), 343, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequestStatistics.cs");
            if (this.rjProvider != null)
            {
                this.rjProvider.Dispose();
                this.rjProvider = null;
            }
            if (base.ParameterSetName.Equals("MigrationRequestQueue"))
            {
                MailboxDatabase mailboxDatabase = (MailboxDatabase)base.GetDataObject <MailboxDatabase>(this.RequestQueue, this.configSession, null, new LocalizedString?(Strings.ErrorMailboxDatabaseNotFound(this.RequestQueue.ToString())), new LocalizedString?(Strings.ErrorMailboxDatabaseNotUnique(this.RequestQueue.ToString())));
                this.rjProvider = new RequestJobProvider(mailboxDatabase.Guid);
            }
            else
            {
                this.rjProvider = new RequestJobProvider(this.gcSession, this.currentOrgConfigSession);
            }
            this.rjProvider.LoadReport = this.IncludeReport;
            return(this.rjProvider);
        }
        internal virtual IConfigurationSession CreateSession()
        {
            this.rootOrgId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, this.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.RescopeToSubtree(sessionSettings), 213, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\ManageOrganizationTaskBase.cs"));
        }
Beispiel #3
0
        protected override IConfigDataProvider CreateSession()
        {
            ADSessionSettings adsessionSettings;

            if (this.AccountPartition != null)
            {
                PartitionId partitionId = RecipientTaskHelper.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError));
                adsessionSettings = ADSessionSettings.FromAllTenantsPartitionId(partitionId);
            }
            else
            {
                adsessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
            }
            if (MapiTaskHelper.IsDatacenter || MapiTaskHelper.IsDatacenterDedicated)
            {
                adsessionSettings.IncludeSoftDeletedObjects = true;
                adsessionSettings.IncludeInactiveMailbox    = true;
            }
            this.CurrentOrgConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, null, adsessionSettings, 479, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequest.cs");
            if (this.AccountPartition == null)
            {
                adsessionSettings = ADSessionSettings.RescopeToSubtree(adsessionSettings);
            }
            this.GCSession     = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 493, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequest.cs");
            this.RecipSession  = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 500, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequest.cs");
            this.ConfigSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, null, ADSessionSettings.FromRootOrgScopeSet(), 506, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\GetRequest.cs");
            if (this.indexProvider != null)
            {
                this.indexProvider = null;
            }
            this.indexProvider = new RequestIndexEntryProvider(this.GCSession, this.CurrentOrgConfigSession);
            return(this.indexProvider);
        }
Beispiel #4
0
        protected override IConfigDataProvider CreateSession()
        {
            ADObjectId rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);

            this.SessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
            ADSessionSettings adsessionSettings = ADSessionSettings.RescopeToSubtree(this.SessionSettings);

            if (MapiTaskHelper.IsDatacenter || MapiTaskHelper.IsDatacenterDedicated)
            {
                adsessionSettings.IncludeSoftDeletedObjects = true;
            }
            this.GCSession        = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, adsessionSettings, 413, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\MoveRequest\\SetMoveRequestBase.cs");
            this.WriteableSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, adsessionSettings, 419, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\MoveRequest\\SetMoveRequestBase.cs");
            if (base.CurrentTaskContext.CanBypassRBACScope)
            {
                this.WriteableSession.EnforceDefaultScope = false;
            }
            if (this.DataObject != null)
            {
                this.DataObject.Dispose();
                this.DataObject = null;
            }
            if (this.MRProvider != null)
            {
                this.MRProvider.Dispose();
                this.MRProvider = null;
            }
            this.MRProvider = new RequestJobProvider(this.WriteableSession, this.ConfigSession);
            return(this.MRProvider);
        }
        internal override IConfigurationSession CreateSession()
        {
            this.rootOrgId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantSubTree, 128, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\UpdateServicePlanTask.cs"));
        }
        protected override void InternalValidate()
        {
            base.InternalValidate();
            if (!this.Identity.IsUnique())
            {
                base.WriteError(new NonUniqueEventCategoryInputException(), ErrorCategory.InvalidData, this.Identity);
            }
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 148, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\EventLog\\SetEventLogLevel.cs");
            EventCategoryIdentity         eventCategoryIdentity        = null;

            if (this.Identity.ToString() != null)
            {
                eventCategoryIdentity = EventCategoryIdentity.Parse(this.Identity.ToString());
            }
            Server obj;

            if (eventCategoryIdentity == null || string.IsNullOrEmpty(eventCategoryIdentity.Server))
            {
                obj = topologyConfigurationSession.FindLocalServer();
            }
            else
            {
                ServerIdParameter serverIdParameter = ServerIdParameter.Parse(eventCategoryIdentity.Server);
                obj = (Server)base.GetDataObject <Server>(serverIdParameter, topologyConfigurationSession, null, null, new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())));
            }
            ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            MapiTaskHelper.VerifyIsWithinConfigWriteScope(sessionSettings, obj, new Task.ErrorLoggerDelegate(base.ThrowTerminatingError));
        }
 // Token: 0x060005A6 RID: 1446 RVA: 0x00015734 File Offset: 0x00013934
 protected override void InternalStateReset()
 {
     TaskLogger.LogEnter();
     this.ResolveCurrentOrgIdBasedOnIdentity(this.Identity);
     this.sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
     base.InternalStateReset();
 }
Beispiel #8
0
 protected override void InternalStateReset()
 {
     using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "ADSessionSettings.FromCustomScopeSet", LoggerHelper.CmdletPerfMonitors))
     {
         this.sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
     }
     base.InternalStateReset();
 }
        protected override IConfigDataProvider CreateSession()
        {
            TaskLogger.LogEnter();
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
            ADSessionSettings sessionSettings    = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            sessionSettings            = ADSessionSettings.RescopeToSubtree(sessionSettings);
            this.readOnlyConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 121, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\OnlineIsInteg\\RemoveMailboxRepairRequest.cs");
            TaskLogger.LogExit();
            return(this.readOnlyConfigSession);
        }
        protected override IConfigDataProvider CreateSession()
        {
            if (OrganizationId.ForestWideOrgId.Equals(base.CurrentOrganizationId))
            {
                base.WriteError(new ArgumentException(Strings.TenantOrganizationMissing, string.Empty), (ErrorCategory)1000, null);
            }
            ADObjectId            rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings     sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerIdForLocalForest, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 149, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\rms\\SetRmsTemplate.cs");

            return(new RmsTemplateDataProvider(tenantOrTopologyConfigurationSession, RmsTemplateType.All, true));
        }
        protected override IConfigDataProvider CreateSession()
        {
            TaskLogger.LogEnter();
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(null, null);
            ADSessionSettings sessionSettings    = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            sessionSettings       = ADSessionSettings.RescopeToSubtree(sessionSettings);
            this.recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(null, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 176, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\Mailbox\\MailboxQuarantineTaskBase.cs");
            this.recipientSession.UseGlobalCatalog = true;
            this.systemConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 186, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\Mailbox\\MailboxQuarantineTaskBase.cs");
            TaskLogger.LogExit();
            return(this.systemConfigSession);
        }
 // Token: 0x060005E0 RID: 1504 RVA: 0x0001657C File Offset: 0x0001477C
 protected override void InternalStateReset()
 {
     if (this.AccountPartition != null)
     {
         PartitionId partitionId = RecipientTaskHelper.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError));
         this.sessionSettings = ADSessionSettings.FromAccountPartitionRootOrgScopeSet(partitionId);
     }
     else
     {
         this.sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
     }
     base.InternalStateReset();
 }
Beispiel #13
0
        protected override IConfigDataProvider CreateSession()
        {
            TaskLogger.LogEnter();
            ADSessionSettings adsessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            this.sessionSettings          = ADSessionSettings.RescopeToSubtree(adsessionSettings);
            this.readOnlyRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, this.sessionSettings, 270, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\OnlineIsInteg\\NewMailboxRepairRequest.cs");
            if (this.DomainController == null)
            {
                this.readOnlyRecipientSession.UseGlobalCatalog = true;
            }
            this.readOnlyConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, this.sessionSettings, 281, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\OnlineIsInteg\\NewMailboxRepairRequest.cs");
            TaskLogger.LogExit();
            return(this.readOnlyConfigSession);
        }
Beispiel #14
0
        protected override IConfigDataProvider CreateSession()
        {
            ADObjectId        rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
            ADSessionSettings sessionSettings    = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            this.CurrentOrgConfigSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 772, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\NewRequest.cs");
            sessionSettings   = ADSessionSettings.RescopeToSubtree(sessionSettings);
            this.GCSession    = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 783, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\NewRequest.cs");
            this.RecipSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 791, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\NewRequest.cs");
            if (this.RJProvider != null)
            {
                this.RJProvider.Dispose();
                this.RJProvider = null;
            }
            this.RJProvider = new RequestJobProvider(this.RecipSession, this.CurrentOrgConfigSession);
            return(this.RJProvider);
        }
        // Token: 0x06000C7A RID: 3194 RVA: 0x00027404 File Offset: 0x00025604
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            TaskLogger.LogEnter();
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (!(session is IConfigurationSession))
            {
                throw new ArgumentException(Strings.ErrorInvalidType(session.GetType().Name), "type");
            }
            notFoundReason = null;
            EnumerableWrapper <T> result = EnumerableWrapper <T> .Empty;

            if (this.IsWildcardDefined(base.RawIdentity))
            {
                notFoundReason = new LocalizedString?(Strings.ErrorOrganizationWildcard);
                return(result);
            }
            OrganizationId organizationId = this.ResolveOrganizationId();

            if (!OrganizationId.ForestWideOrgId.Equals(organizationId))
            {
                ADSessionSettings adsessionSettings = ADSessionSettings.FromCustomScopeSet(ScopeSet.ResolveUnderScope(organizationId, session.SessionSettings.ScopeSet), session.SessionSettings.RootOrgId, organizationId, session.SessionSettings.ExecutingUserOrganizationId, false);
                adsessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants;
                ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(session.DomainController, session.ReadOnly, session.ConsistencyMode, session.NetworkCredential, adsessionSettings, 257, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\TenantRelocationRequestIdParameter.cs");
                tenantConfigurationSession.UseConfigNC      = session.UseConfigNC;
                tenantConfigurationSession.UseGlobalCatalog = session.UseGlobalCatalog;
                if (typeof(TenantRelocationRequest).Equals(typeof(T)) && organizationId.ConfigurationUnit != null)
                {
                    List <TenantRelocationRequest> list  = new List <TenantRelocationRequest>();
                    TenantRelocationRequest[]      array = tenantConfigurationSession.Find <TenantRelocationRequest>(organizationId.ConfigurationUnit, QueryScope.SubTree, TenantRelocationRequest.TenantRelocationRequestFilter, null, 1);
                    if (array != null && array.Length > 0)
                    {
                        list.Add(array[0]);
                        result = EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) list, this.GetEnumerableFilter <T>());
                    }
                }
            }
            TaskLogger.LogExit();
            return(result);
        }
        // Token: 0x06000AFC RID: 2812 RVA: 0x00023724 File Offset: 0x00021924
        internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
        {
            TaskLogger.LogEnter();
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (!(session is IConfigurationSession))
            {
                throw new ArgumentException(Strings.ErrorInvalidType(session.GetType().Name), "session");
            }
            if (((typeof(T) == typeof(ADOrganizationalUnit) && session.UseConfigNC) || (typeof(T) == typeof(ExchangeConfigurationUnit) && !session.UseConfigNC)) && !Environment.StackTrace.Contains("Microsoft.Exchange.Management.Deployment.OrganizationTaskHelper.GetExchangeConfigUnitFromOrganizationId"))
            {
                throw new ArgumentException("Session is using the wrong Naming Context for the desired search");
            }
            notFoundReason = null;
            EnumerableWrapper <T> result = EnumerableWrapper <T> .Empty;

            if (base.IsMultitenancyEnabled())
            {
                if (this.IsWildcardDefined(base.RawIdentity))
                {
                    if (null == this.AccountPartition)
                    {
                        notFoundReason = new LocalizedString?(Strings.ErrorOrganizationWildcard);
                        return(result);
                    }
                    IEnumerable <ExchangeConfigurationUnit> configurationUnits = this.GetConfigurationUnits((IConfigurationSession)session, base.RawIdentity);
                    return(EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) configurationUnits, this.GetEnumerableFilter <T>()));
                }
                else
                {
                    OrganizationId organizationId = this.ResolveOrganizationId(session.SessionSettings.CurrentOrganizationId);
                    if (!OrganizationId.ForestWideOrgId.Equals(organizationId))
                    {
                        ADSessionSettings adsessionSettings = ADSessionSettings.FromCustomScopeSet(ScopeSet.ResolveUnderScope(organizationId, session.SessionSettings.ScopeSet), session.SessionSettings.RootOrgId, organizationId, session.SessionSettings.ExecutingUserOrganizationId, true);
                        adsessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants;
                        bool flag = TaskHelper.ShouldPassDomainControllerToSession(session.DomainController, adsessionSettings);
                        ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(flag ? session.DomainController : null, session.ReadOnly, session.ConsistencyMode, flag ? session.NetworkCredential : null, adsessionSettings, 314, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\organizationidparameter.cs");
                        tenantConfigurationSession.UseConfigNC      = session.UseConfigNC;
                        tenantConfigurationSession.UseGlobalCatalog = session.UseGlobalCatalog;
                        if (typeof(ExchangeConfigurationUnit) == typeof(T) && organizationId.ConfigurationUnit != null)
                        {
                            List <ExchangeConfigurationUnit> list = new List <ExchangeConfigurationUnit>();
                            ExchangeConfigurationUnit        exchangeConfigurationUnit = tenantConfigurationSession.Read <ExchangeConfigurationUnit>(organizationId.ConfigurationUnit);
                            if (exchangeConfigurationUnit != null)
                            {
                                list.Add(exchangeConfigurationUnit);
                                result = EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) list, this.GetEnumerableFilter <T>());
                            }
                        }
                        else if (organizationId.OrganizationalUnit != null)
                        {
                            List <ADOrganizationalUnit> list2 = new List <ADOrganizationalUnit>();
                            ADOrganizationalUnit        adorganizationalUnit = tenantConfigurationSession.Read <ADOrganizationalUnit>(organizationId.OrganizationalUnit);
                            if (adorganizationalUnit != null)
                            {
                                list2.Add(adorganizationalUnit);
                                result = EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) list2, this.GetEnumerableFilter <T>());
                            }
                        }
                    }
                }
            }
            TaskLogger.LogExit();
            return(result);
        }
        private void CheckRbac()
        {
            ADScopeException             ex = null;
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>) this.DataObject[ADObjectSchema.ObjectClass];

            if (multiValuedProperty.Contains("person") || multiValuedProperty.Contains("msExchDynamicDistributionList") || multiValuedProperty.Contains("group") || multiValuedProperty.Contains("publicFolder") || multiValuedProperty.Contains("msExchPublicMDB") || multiValuedProperty.Contains("msExchSystemMailbox") || multiValuedProperty.Contains(ADMicrosoftExchangeRecipient.MostDerivedClass) || multiValuedProperty.Contains("exchangeAdminService") || multiValuedProperty.Contains("computer"))
            {
                IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, this.DataObject.Id, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 581, "CheckRbac", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\permission\\SetADPermissionTaskBase.cs");
                ADRecipient       adrecipient = tenantOrRootOrgRecipientSession.Read(this.DataObject.Id);
                if (adrecipient == null)
                {
                    base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorObjectNotFound(this.Identity.ToString())), ErrorCategory.InvalidArgument, null);
                }
                if (!tenantOrRootOrgRecipientSession.TryVerifyIsWithinScopes(adrecipient, true, out ex))
                {
                    base.WriteError(new TaskInvalidOperationException(Strings.ErrorCannotChangeObjectOutOfWriteScope(adrecipient.Identity.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ExchangeErrorCategory.Client, adrecipient.Identity);
                    return;
                }
            }
            else
            {
                ADObject adobject = null;
                bool     flag     = false;
                IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, this.DataObject.Id, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 620, "CheckRbac", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\permission\\SetADPermissionTaskBase.cs");
                if (multiValuedProperty.Contains("msExchOabVirtualDirectory"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <ADOabVirtualDirectory>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("ServiceConnectionPoint"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <ADServiceConnectionPoint>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("RpcClientAccess"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <ExchangeRpcClientAccess>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchProtocolCfgHTTPContainer"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <HttpContainer>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchProtocolCfgIMAPContainer"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <Imap4Container>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchInformationStore"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <InformationStore>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("mTA"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <MicrosoftMTAConfiguration>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchProtocolCfgPOPContainer"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <Pop3Container>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("protocolCfgSharedServer"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <ProtocolsContainer>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchSmtpReceiveConnector"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <ReceiveConnector>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchExchangeServer"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <Server>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchProtocolCfgSMTPContainer"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <SmtpContainer>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("protocolCfgSMTPServer"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <SmtpVirtualServerConfiguration>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchMDB"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <Database>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("msExchPrivateMDB"))
                {
                    adobject = tenantOrTopologyConfigurationSession.Read <MailboxDatabase>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains(ADOrganizationalUnit.MostDerivedClass))
                {
                    tenantOrTopologyConfigurationSession.UseConfigNC = false;
                    adobject = tenantOrTopologyConfigurationSession.Read <ADOrganizationalUnit>(this.DataObject.Id);
                    flag     = true;
                }
                else if (multiValuedProperty.Contains("domain"))
                {
                    tenantOrTopologyConfigurationSession.UseConfigNC = false;
                    adobject = tenantOrTopologyConfigurationSession.Read <ADDomain>(this.DataObject.Id);
                    flag     = true;
                }
                if (flag)
                {
                    if (adobject == null)
                    {
                        base.WriteError(new ManagementObjectNotFoundException(Strings.ErrorObjectNotFound(this.Identity.ToString())), ErrorCategory.InvalidArgument, null);
                    }
                    if (!tenantOrTopologyConfigurationSession.TryVerifyIsWithinScopes(adobject, true, out ex))
                    {
                        base.WriteError(new TaskInvalidOperationException(Strings.ErrorCannotChangeObjectOutOfWriteScope(adobject.Identity.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ExchangeErrorCategory.Client, adobject.Identity);
                    }
                }
            }
        }
Beispiel #18
0
        private void VerifyAndSetRecipientViewRoot(string root)
        {
            if (object.Equals(root, this.modifiedServerSettings.RecipientViewRoot))
            {
                return;
            }
            OrganizationalUnitIdParameter organizationalUnitIdParameter = null;

            try
            {
                organizationalUnitIdParameter = OrganizationalUnitIdParameter.Parse(root);
            }
            catch (ArgumentException exception)
            {
                base.WriteError(exception, ErrorCategory.InvalidArgument, this);
            }
            if (this.configSession == null)
            {
                ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
                this.configSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 588, "VerifyAndSetRecipientViewRoot", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\ADServerSettings\\SetADServerSettings.cs");
                this.configSession.UseGlobalCatalog = true;
                this.configSession.UseConfigNC      = false;
            }
            ADObjectId adobjectId = null;

            if (base.ScopeSet.RecipientReadScope != null && base.ScopeSet.RecipientReadScope.Root != null)
            {
                adobjectId = base.ScopeSet.RecipientReadScope.Root;
            }
            ExchangeOrganizationalUnit exchangeOrganizationalUnit = null;

            if (base.IsVerboseOn)
            {
                base.WriteVerbose(Strings.VerboseVerifyingRecipientViewRoot(root));
            }
            IEnumerable <ExchangeOrganizationalUnit> objects = organizationalUnitIdParameter.GetObjects <ExchangeOrganizationalUnit>(adobjectId, this.configSession);

            using (IEnumerator <ExchangeOrganizationalUnit> enumerator = objects.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    exchangeOrganizationalUnit = enumerator.Current;
                    if (enumerator.MoveNext())
                    {
                        if (adobjectId != null)
                        {
                            base.WriteError(new ManagementObjectAmbiguousException(Strings.ErrorRecipientViewRootDuplicatedUnderScope(root, adobjectId.ToString())), ErrorCategory.InvalidArgument, this);
                        }
                        else
                        {
                            base.WriteError(new ManagementObjectAmbiguousException(Strings.ErrorRecipientViewRootDuplicated(root)), ErrorCategory.InvalidArgument, this);
                        }
                    }
                }
                else if (adobjectId != null)
                {
                    base.WriteError(new ArgumentException(Strings.ErrorRecipientViewRootNotFoundUnderScope(root, adobjectId.ToString())), ErrorCategory.InvalidArgument, this);
                }
                else
                {
                    base.WriteError(new ArgumentException(Strings.ErrorRecipientViewRootNotFound(root)), ErrorCategory.InvalidArgument, this);
                }
            }
            this.modifiedServerSettings.RecipientViewRoot = exchangeOrganizationalUnit.Id;
            if (base.IsVerboseOn)
            {
                base.WriteVerbose(Strings.VerboseVerifyRecipientViewRootSucceed);
            }
        }
Beispiel #19
0
 private void ValidateAndSetServerContext()
 {
     if (this.Server == null)
     {
         return;
     }
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteExchangeVersionNotSupported), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 283, "ValidateAndSetServerContext", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\OAuth\\SetAuthConfig.cs"), this.serverObject, false, new DataAccessTask <AuthConfig> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
 }
        protected override IConfigDataProvider CreateSession()
        {
            ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 142, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\IntraOrganizationConnector\\GetIntraOrganizationConfiguration.cs"));
        }
 protected override void InternalStateReset()
 {
     this.sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
     base.InternalStateReset();
 }
Beispiel #22
0
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (this.Server == null)
     {
         this.Server = new ServerIdParameter();
     }
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteCertificateExchangeVersionNotSupported(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 325, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\NewExchangeCertificate.cs"), this.serverObject, true, new DataAccessTask <Server> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
     this.ValidateParameters();
     this.inputParams = new ExchangeCertificateRpc();
     this.inputParams.CreateExportable        = this.PrivateKeyExportable;
     this.inputParams.CreateIncAccepted       = this.IncludeAcceptedDomains;
     this.inputParams.CreateIncFqdn           = this.IncludeServerFQDN;
     this.inputParams.CreateIncNetBios        = this.IncludeServerNetBIOSName;
     this.inputParams.CreateIncAutoDisc       = this.IncludeAutoDiscover;
     this.inputParams.CreateBinary            = this.BinaryEncoded;
     this.inputParams.CreateRequest           = this.GenerateRequest;
     this.inputParams.CreateKeySize           = this.KeySize;
     this.inputParams.CreateServices          = this.Services;
     this.inputParams.CreateAllowConfirmation = !this.Force;
     if (this.FriendlyName != null)
     {
         this.inputParams.CreateFriendlyName = this.FriendlyName;
     }
     if (this.SubjectName != null)
     {
         this.inputParams.CreateSubjectName = this.SubjectName.Name;
     }
     if (this.SubjectKeyIdentifier != null)
     {
         this.inputParams.CreateSubjectKeyIdentifier = this.SubjectKeyIdentifier;
     }
     if (this.DomainName != null)
     {
         this.inputParams.CreateDomains = this.DomainName;
     }
     if (this.Instance != null)
     {
         this.inputParams.CreateCloneCert = this.Instance.Export(X509ContentType.SerializedCert);
     }
 }
        protected override IConfigDataProvider CreateSession()
        {
            ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.PartiallyConsistent, sessionSettings, 121, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\TeamMailbox\\TeamMailboxDiagnosticsBase.cs"));
        }
Beispiel #24
0
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     if (this.Server == null)
     {
         this.Server = new ServerIdParameter();
     }
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteCertificateExchangeVersionNotSupported(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 207, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\ImportExchangeCertificate.cs"), this.serverObject, true, new DataAccessTask <Server> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
     if (this.Instance == null && this.FileData == null && string.IsNullOrEmpty(this.FileName))
     {
         base.WriteError(new ArgumentException(Strings.ImportCertificateDataIsNull(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
 }
Beispiel #25
0
        internal static IConfigDataProvider CreateConfigSession(OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId)
        {
            ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(ScopeSet.GetOrgWideDefaultScopeSet(currentOrganizationId), ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), currentOrganizationId, executingUserOrganizationId, true);

            return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 102, "CreateConfigSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\FfoReporting\\Common\\ADHelper.cs"));
        }
Beispiel #26
0
        // Token: 0x0600120B RID: 4619 RVA: 0x000384FC File Offset: 0x000366FC
        private static MailboxDatabaseWithLocationInfo VerifyStatusAndSelectDB(List <MailboxDatabaseWithLocationInfo> databases, string domainController, LogMessageDelegate logger, ScopeSet scopeSet)
        {
            Guid[]      array  = new Guid[1];
            MdbStatus[] array2 = new MdbStatus[1];
            Dictionary <string, ExRpcAdmin> dictionary  = new Dictionary <string, ExRpcAdmin>(100);
            Dictionary <string, string>     dictionary2 = new Dictionary <string, string>(100);
            ITopologyConfigurationSession   topologyConfigurationSession = PhysicalResourceLoadBalancing.CreateGlobalConfigSession(domainController);
            IConfigurationSession           configurationSession         = null;

            if (scopeSet != null && !PhysicalResourceLoadBalancing.IsDatacenter)
            {
                configurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(scopeSet, topologyConfigurationSession.SessionSettings.RootOrgId, topologyConfigurationSession.SessionSettings.CurrentOrganizationId, topologyConfigurationSession.SessionSettings.ExecutingUserOrganizationId, true), 801, "VerifyStatusAndSelectDB", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\Provisioning\\LoadBalancing\\PhysicalResourceLoadBalancing.cs");
            }
            try
            {
                Random random = new Random();
                for (int i = databases.Count - 1; i >= 0; i--)
                {
                    if (i != 0)
                    {
                        int index = random.Next(i + 1);
                        MailboxDatabaseWithLocationInfo value = databases[index];
                        databases[index] = databases[i];
                        databases[i]     = value;
                    }
                    MailboxDatabase mailboxDatabase = databases[i].MailboxDatabase;
                    string          text            = string.Empty;
                    try
                    {
                        if (configurationSession != null)
                        {
                            PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbCheckingDatabaseIsAllowedOnScope(mailboxDatabase.Id.ToDNString()), logger);
                            ADScopeException ex;
                            if (!configurationSession.TryVerifyIsWithinScopes(mailboxDatabase, false, out ex))
                            {
                                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbDatabaseNotInUserScope(mailboxDatabase.Id.ToDNString(), ex.ToString()), logger);
                                goto IL_2C6;
                            }
                        }
                        DatabaseLocationInfo databaseLocationInfo = databases[i].DatabaseLocationInfo;
                        text = databaseLocationInfo.ServerFqdn;
                        ADObjectId serverSite = databaseLocationInfo.ServerSite;
                        PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbDatabaseAndServerTry(mailboxDatabase.Id.ToDNString(), text ?? "null"), logger);
                        if (!string.IsNullOrEmpty(text) && !dictionary2.ContainsKey(text))
                        {
                            ExRpcAdmin exRpcAdmin;
                            if (dictionary.ContainsKey(text))
                            {
                                exRpcAdmin = dictionary[text];
                                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbExRpcAdminExists, logger);
                            }
                            else
                            {
                                exRpcAdmin = ExRpcAdmin.Create("Client=Management", text, null, null, null);
                                dictionary.Add(text, exRpcAdmin);
                                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbCreateNewExRpcAdmin, logger);
                            }
                            array[0] = mailboxDatabase.Id.ObjectGuid;
                            array2   = exRpcAdmin.ListMdbStatus(array);
                            PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbTryRetrieveDatabaseStatus, logger);
                            if ((array2[0].Status & MdbStatusFlags.Online) != MdbStatusFlags.Offline)
                            {
                                PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbDatabaseFound, logger);
                                return(new MailboxDatabaseWithLocationInfo(mailboxDatabase, databaseLocationInfo));
                            }
                            PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbDatabaseIsNotOnline((int)array2[0].Status), logger);
                        }
                        else
                        {
                            PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbServerDownSoMarkDatabaseDown, logger);
                        }
                    }
                    catch (DatabaseNotFoundException ex2)
                    {
                        PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbDatabaseNotFoundException(ex2.Message), logger);
                    }
                    catch (ObjectNotFoundException ex3)
                    {
                        PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNoServerForDatabaseException(ex3.Message), logger);
                    }
                    catch (MapiExceptionNetworkError mapiExceptionNetworkError)
                    {
                        PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNetworkError(mapiExceptionNetworkError.Message), logger);
                        dictionary2.Add(text, text);
                    }
                    catch (MapiPermanentException ex4)
                    {
                        PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbPermanentException(ex4.Message), logger);
                        dictionary2.Add(text, text);
                    }
                    catch (MapiRetryableException ex5)
                    {
                        PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbRetryableException(ex5.Message), logger);
                    }
                    IL_2C6 :;
                }
            }
            finally
            {
                foreach (string text2 in dictionary.Keys)
                {
                    PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbDisposeExRpcAdmin(text2), logger);
                    dictionary[text2].Dispose();
                }
            }
            PhysicalResourceLoadBalancing.LogVerbose(Strings.VerboseLbNoAvailableDatabase, logger);
            return(null);
        }
 protected override void InternalValidate()
 {
     base.InternalValidate();
     if (base.HasErrors)
     {
         return;
     }
     GetExchangeCertificate.PrepareParameters(this);
     this.serverObject = (Server)base.GetDataObject <Server>(this.Server, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)this.Server)), new LocalizedString?(Strings.ErrorServerNotUnique((string)this.Server)));
     if (!this.serverObject.IsE14OrLater)
     {
         base.WriteError(new ArgumentException(Strings.RemoteCertificateExchangeVersionNotSupported(this.serverObject.Name)), ErrorCategory.InvalidArgument, null);
     }
     base.VerifyIsWithinScopes(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true), 189, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageSecurity\\ExchangeCertificate\\ExportExchangeCertificate.cs"), this.serverObject, false, new DataAccessTask <Server> .ADObjectOutOfScopeString(Strings.ErrorServerOutOfScope));
     if (string.IsNullOrEmpty(this.Thumbprint))
     {
         base.WriteError(new ArgumentException(Strings.ExceptionEmptyStringNotAllowed, "Thumbprint"), ErrorCategory.InvalidArgument, null);
     }
     this.Thumbprint = ManageExchangeCertificate.UnifyThumbprintFormat(this.Thumbprint);
     if (!string.IsNullOrEmpty(this.FileName) && (File.Exists(this.FileName) || File.Exists(this.FileName + ".pfx")))
     {
         base.WriteError(new ArgumentException(Strings.CertificateInvalidFileName(this.serverObject.Name), "FileName"), ErrorCategory.InvalidArgument, null);
     }
 }
Beispiel #28
0
        protected override void InternalValidate()
        {
            TaskLogger.LogEnter();
            base.InternalValidate();
            if ("Linked" == base.ParameterSetName)
            {
                try
                {
                    NetworkCredential userForestCredential = (this.LinkedCredential == null) ? null : this.LinkedCredential.GetNetworkCredential();
                    this.linkedUserSid = MailboxTaskHelper.GetAccountSidFromAnotherForest(this.LinkedMasterAccount, this.LinkedDomainController, userForestCredential, this.ResourceForestSession, new MailboxTaskHelper.GetUniqueObject(base.GetDataObject <ADUser>), new Task.ErrorLoggerDelegate(base.ThrowTerminatingError));
                }
                catch (PSArgumentException exception)
                {
                    base.ThrowTerminatingError(exception, ErrorCategory.InvalidArgument, this.LinkedCredential);
                }
            }
            if (this.ManagedFolderMailboxPolicy != null)
            {
                ManagedFolderMailboxPolicy managedFolderMailboxPolicy = (ManagedFolderMailboxPolicy)base.GetDataObject <ManagedFolderMailboxPolicy>(this.ManagedFolderMailboxPolicy, this.TenantConfigurationSession, null, new LocalizedString?(Strings.ErrorManagedFolderMailboxPolicyNotFound(this.ManagedFolderMailboxPolicy.ToString())), new LocalizedString?(Strings.ErrorManagedFolderMailboxPolicyNotUnique(this.ManagedFolderMailboxPolicy.ToString())));
                this.elcPolicyId = (ADObjectId)managedFolderMailboxPolicy.Identity;
            }
            if (this.RetentionPolicy != null)
            {
                if (SharedConfiguration.IsDehydratedConfiguration(base.CurrentOrganizationId))
                {
                    base.WriteError(new LocalizedException(Strings.ErrorLinkOpOnDehydratedTenant("RetentionPolicy")), ExchangeErrorCategory.Client, null);
                }
                RetentionPolicy retentionPolicy = (RetentionPolicy)base.GetDataObject <RetentionPolicy>(this.RetentionPolicy, this.TenantConfigurationSession, null, new LocalizedString?(Strings.ErrorRetentionPolicyNotFound(this.RetentionPolicy.ToString())), new LocalizedString?(Strings.ErrorRetentionPolicyNotUnique(this.RetentionPolicy.ToString())));
                this.retentionPolicyId = retentionPolicy.Id;
            }
            if (this.ActiveSyncMailboxPolicy != null)
            {
                MobileMailboxPolicy mobileMailboxPolicy = (MobileMailboxPolicy)base.GetDataObject <MobileMailboxPolicy>(this.ActiveSyncMailboxPolicy, this.TenantConfigurationSession, null, new LocalizedString?(Strings.ErrorMobileMailboxPolicyNotFound(this.ActiveSyncMailboxPolicy.ToString())), new LocalizedString?(Strings.ErrorMobileMailboxPolicyNotUnique(this.ActiveSyncMailboxPolicy.ToString())));
                this.mobilePolicyId = (ADObjectId)mobileMailboxPolicy.Identity;
            }
            if (this.AddressBookPolicy != null)
            {
                AddressBookMailboxPolicy addressBookMailboxPolicy = (AddressBookMailboxPolicy)base.GetDataObject <AddressBookMailboxPolicy>(this.AddressBookPolicy, this.TenantConfigurationSession, null, new LocalizedString?(Strings.ErrorAddressBookMailboxPolicyNotFound(this.AddressBookPolicy.ToString())), new LocalizedString?(Strings.ErrorAddressBookMailboxPolicyNotUnique(this.AddressBookPolicy.ToString())), ExchangeErrorCategory.Client);
                this.addressBookPolicyId = (ADObjectId)addressBookMailboxPolicy.Identity;
            }
            MailboxTaskHelper.ValidateMailboxIsDisconnected(this.GlobalCatalogSession, this.DataObject.MailboxGuid, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError));
            if (!this.Archive)
            {
                ConnectMailbox.CheckLegacyDNNotInUse(this.DataObject.Identity, this.DataObject.LegacyDN, this.GlobalCatalogSession, new Task.ErrorLoggerDelegate(base.WriteError));
            }
            if (this.User != null)
            {
                this.userToConnect = (ADUser)base.GetDataObject <ADUser>(this.User, this.RecipientSession, null, new LocalizedString?(Strings.ErrorRecipientNotFound(this.User.ToString())), new LocalizedString?(Strings.ErrorRecipientNotUnique(this.User.ToString())));
                if (this.Archive)
                {
                    ConnectMailbox.CheckUserForArchive(this.DataObject, this.GlobalCatalogSession, new Task.ErrorLoggerDelegate(base.WriteError), this.userToConnect, this.OwnerMailboxDatabase, this.AllowLegacyDNMismatch);
                }
                else if (RecipientType.User != this.userToConnect.RecipientType)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorNoMatchedUserTypeFound(RecipientType.User.ToString(), this.User.ToString(), this.userToConnect.RecipientType.ToString())), ErrorCategory.InvalidArgument, this.User);
                }
            }
            else if (!this.Archive)
            {
                if ("ValidateOnly" == base.ParameterSetName)
                {
                    this.matchedUsers = this.FindMatchedUser(this.DataObject, null);
                }
                else
                {
                    this.matchedUsers = this.FindMatchedUser(this.DataObject, new bool?("User" == base.ParameterSetName));
                }
                if ("ValidateOnly" != base.ParameterSetName)
                {
                    if (this.matchedUsers.Length == 0)
                    {
                        base.WriteError(new MdbAdminTaskException(Strings.ErrorNoMatchedUserFound), ErrorCategory.InvalidArgument, this.Identity);
                    }
                    else if (this.matchedUsers.Length > 1)
                    {
                        this.WriteWarning(Strings.ErrorMultipleMatchedUser(this.Identity.ToString()));
                        this.needListMatchingUser = true;
                    }
                    else
                    {
                        this.userToConnect = (ADUser)this.matchedUsers[0];
                        this.userToConnect = (ADUser)this.RecipientSession.Read(this.userToConnect.Id);
                        if (this.userToConnect == null)
                        {
                            base.WriteError(new MdbAdminTaskException(Strings.ErrorNoMatchedUserFound), ErrorCategory.InvalidArgument, this.Identity);
                        }
                        if (this.Archive)
                        {
                            ConnectMailbox.CheckUserForArchive(this.DataObject, this.GlobalCatalogSession, new Task.ErrorLoggerDelegate(base.WriteError), this.userToConnect, this.OwnerMailboxDatabase, this.AllowLegacyDNMismatch);
                        }
                    }
                }
            }
            else
            {
                this.userToConnect = this.FindArchiveUser(this.DataObject, this.RecipientSession, new Task.TaskErrorLoggingDelegate(base.WriteError));
                ConnectMailbox.CheckUserForArchive(this.DataObject, this.GlobalCatalogSession, new Task.ErrorLoggerDelegate(base.WriteError), this.userToConnect, this.OwnerMailboxDatabase, this.AllowLegacyDNMismatch);
            }
            if (this.userToConnect != null && !this.Archive)
            {
                if ("User" == base.ParameterSetName)
                {
                    if ((this.userToConnect.UserAccountControl & UserAccountControlFlags.AccountDisabled) != UserAccountControlFlags.None && this.DataObject.MailboxType == StoreMailboxType.Private)
                    {
                        base.WriteError(new RecipientTaskException(Strings.ErrorAccountDisabledForUserMailbox), ErrorCategory.InvalidArgument, this.userToConnect);
                    }
                }
                else if ((this.userToConnect.UserAccountControl & UserAccountControlFlags.AccountDisabled) == UserAccountControlFlags.None)
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorAccountEnabledForNonUserMailbox), ErrorCategory.InvalidArgument, this.userToConnect);
                }
                if (!string.IsNullOrEmpty(this.Alias))
                {
                    this.alias = this.Alias;
                }
                else
                {
                    this.alias = RecipientTaskHelper.GenerateUniqueAlias(this.globalCatalogSession, this.userToConnect.OrganizationId, this.userToConnect.Name, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                }
            }
            if (this.Archive && this.userToConnect.ManagedFolderMailboxPolicy != null)
            {
                base.WriteError(new MdbAdminTaskException(Strings.ErrorNoArchiveWithManagedFolder(this.userToConnect.Name)), ErrorCategory.InvalidData, this.Identity);
            }
            if (this.DataObject.IsArchiveMailbox != null && this.Archive != this.DataObject.IsArchiveMailbox.Value)
            {
                if (this.Archive)
                {
                    base.WriteError(new MdbAdminTaskException(Strings.ErrorDisconnectedMailboxNotArchive(this.Identity.ToString(), this.userToConnect.Name)), ErrorCategory.InvalidArgument, this.Identity);
                }
                else
                {
                    base.WriteError(new MdbAdminTaskException(Strings.ErrorDisconnectedMailboxNotPrimary(this.Identity.ToString(), this.userToConnect.Name)), ErrorCategory.InvalidArgument, this.Identity);
                }
            }
            ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);

            MapiTaskHelper.VerifyDatabaseIsWithinScope(sessionSettings, this.OwnerMailboxDatabase, new Task.ErrorLoggerDelegate(base.WriteError));
            TaskLogger.LogExit();
        }