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"));
        }
        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"));
        }
Esempio n. 3
0
        public virtual string GetTargetPath(ExSearchResultEntry entry)
        {
            string text;

            if (this.type == SyncTreeType.Recipients)
            {
                DirectoryAttribute directoryAttribute = entry.Attributes["objectGUID"];
                Guid guid = new Guid((byte[])directoryAttribute.GetValues(typeof(byte[]))[0]);
                text = "cn=" + guid.ToString() + ",CN=Recipients,OU=MSExchangeGateway";
            }
            else
            {
                if (LdapTargetConnection.rootOrgContainerDN == null)
                {
                    LdapTargetConnection.rootOrgContainerDN = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().DistinguishedName;
                }
                string text2      = entry.DistinguishedName;
                int    startIndex = -1;
                int    count      = 0;
                if (entry.IsCollisionObject(out startIndex, out count))
                {
                    text2 = text2.Remove(startIndex, count);
                }
                text = text2.Replace(LdapTargetConnection.rootOrgContainerDN, this.adamRootOrgContainerDN);
            }
            ExTraceGlobals.SynchronizationJobTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Translate source DN {0} to target DN {1}", entry.DistinguishedName, text);
            return(text);
        }
Esempio n. 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);
        }
Esempio n. 5
0
            private static IEnumerable <PolicyTipMessageConfig> GetBuiltIn()
            {
                ADObjectId GlobalScopeContainerId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().GetDescendantId(PolicyTipMessageConfig.PolicyTipMessageConfigContainer);
                IEnumerable <CultureInfo> supportedCultureInfos = from lcid in LanguagePackInfo.expectedCultureLcids
                                                                  select new CultureInfo(lcid);
                PolicyTipMessageConfig policyTipMessageConfig;

                foreach (CultureInfo exchangeCultureInfo in supportedCultureInfos)
                {
                    foreach (Tuple <PolicyTipMessageConfigAction, LocalizedString> mapping in PerTenantPolicyNudgeRulesCollection.PolicyTipMessages.builtInActionStringsMapping)
                    {
                        policyTipMessageConfig = new PolicyTipMessageConfig
                        {
                            Action = mapping.Item1,
                            Locale = exchangeCultureInfo.Name,
                            Value  = mapping.Item2.ToString(exchangeCultureInfo)
                        };
                        policyTipMessageConfig.SetId(GlobalScopeContainerId.GetChildId("BuiltIn\\" + exchangeCultureInfo.Name + "\\" + mapping.Item1.ToString()));
                        yield return(policyTipMessageConfig);
                    }
                }
                policyTipMessageConfig = new PolicyTipMessageConfig
                {
                    Action = PolicyTipMessageConfigAction.Url,
                    Locale = string.Empty,
                    Value  = string.Empty
                };
                policyTipMessageConfig.SetId(GlobalScopeContainerId.GetChildId("BuiltIn\\" + PolicyTipMessageConfigAction.Url.ToString()));
                yield return(policyTipMessageConfig);

                yield break;
            }
Esempio n. 6
0
        internal static OrganizationId ResolveOrganization(OrganizationIdParameter organization, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId)
        {
            if (organization == null)
            {
                return(null);
            }
            ADObjectId            rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, currentOrganizationId, executingUserOrganizationId, false);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantSubTree, 48, "ResolveOrganization", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\FfoReporting\\Common\\ADHelper.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = false;
            ADOrganizationalUnit adorganizationalUnit  = null;
            LocalizedString?     localizedString       = null;
            IEnumerable <ADOrganizationalUnit> objects = organization.GetObjects <ADOrganizationalUnit>(null, tenantOrTopologyConfigurationSession, null, out localizedString);

            using (IEnumerator <ADOrganizationalUnit> enumerator = objects.GetEnumerator())
            {
                if (!enumerator.MoveNext())
                {
                    throw new ManagementObjectNotFoundException(Strings.ErrorOrganizationNotFound(organization.ToString()));
                }
                adorganizationalUnit = enumerator.Current;
                if (enumerator.MoveNext())
                {
                    throw new ManagementObjectAmbiguousException(Strings.ErrorOrganizationNotUnique(organization.ToString()));
                }
            }
            return(adorganizationalUnit.OrganizationId);
        }
 static Canary15DataSegment()
 {
     Canary15Trace.TraceDateTime(Canary15DataSegment.UtcNow, 0, "Canary15DataSegment().UtcNow.");
     Canary15Trace.TraceTimeSpan(Canary15DataSegment.defaultRefreshPeriod, 1, "Canary15DataSegment().defaultRefreshPeriod.");
     Canary15Trace.TraceTimeSpan(Canary15DataSegment.ReplicationDuration, 2, "Canary15DataSegment().ReplicationDuration.");
     Canary15DataSegment.topoConfigSession      = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 119, ".cctor", "f:\\15.00.1497\\sources\\dev\\clients\\src\\common\\Canary15DataSegment.cs");
     Canary15DataSegment.adClientAccessObjectId = Canary15DataSegment.topoConfigSession.GetClientAccessContainerId();
     Canary15DataSegment.LoadClientAccessADObject();
     byte[] array  = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().ObjectGuid.ToByteArray();
     byte[] array2 = Canary15DataSegment.topoConfigSession.GetDatabasesContainerId().ObjectGuid.ToByteArray();
     Canary15DataSegment.adObjectIdsBinary = new byte[array.Length + array2.Length];
     array.CopyTo(Canary15DataSegment.adObjectIdsBinary, 0);
     array2.CopyTo(Canary15DataSegment.adObjectIdsBinary, array.Length);
     if (Canary15Trace.IsTraceEnabled(TraceType.DebugTrace))
     {
         using (SHA256Cng sha256Cng = new SHA256Cng())
         {
             byte[] bytes = sha256Cng.ComputeHash(Canary15DataSegment.adObjectIdsBinary);
             Canary15Trace.TraceDebug(2L, "adObjectIdsBinaryHash:{0}", new object[]
             {
                 Canary15DataSegment.GetHexString(bytes)
             });
             sha256Cng.Clear();
         }
     }
 }
Esempio n. 8
0
        // Token: 0x06000577 RID: 1399 RVA: 0x00014FA0 File Offset: 0x000131A0
        private void LoadRoleAssignments()
        {
            if (!typeof(TDataObject).IsAssignableFrom(typeof(ADUser)))
            {
                this.roleAssignments = null;
                return;
            }
            TDataObject dataObject = base.DataObject;
            ADObjectId  adobjectId;

            if (!dataObject.OrganizationId.Equals(OrganizationId.ForestWideOrgId))
            {
                TDataObject dataObject2 = base.DataObject;
                adobjectId = dataObject2.OrganizationId.ConfigurationUnit;
            }
            else
            {
                adobjectId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            }
            ADObjectId            adobjectId2     = adobjectId;
            ADObjectId            rootOrgId       = adobjectId2;
            TDataObject           dataObject3     = base.DataObject;
            ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgId, dataObject3.OrganizationId, base.ExecutingUserOrganizationId, false);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.TenantGlobalCatalogSession.DomainController, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 340, "LoadRoleAssignments", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\RemoveAdObjectTask.cs");
            IConfigurationSession configurationSession = tenantOrTopologyConfigurationSession;

            ADObjectId[] array       = new ADObjectId[1];
            ADObjectId[] array2      = array;
            int          num         = 0;
            TDataObject  dataObject4 = base.DataObject;

            array2[num]          = dataObject4.Id;
            this.roleAssignments = configurationSession.FindRoleAssignmentsByUserIds(array, false);
        }
        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 override IThrottlingPolicy InternalLookup()
        {
            ADObjectId rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            string     distinguishedName  = string.Format("CN={0},CN=Global Settings,{1}", "TenantHydrationThrottlingPolicy", rootOrgContainerIdForLocalForest.DistinguishedName);
            ADObjectId throttlingPolicyId = new ADObjectId(distinguishedName);

            return(ThrottlingPolicyCache.Singleton.Get(OrganizationId.ForestWideOrgId, throttlingPolicyId));
        }
Esempio n. 11
0
 public static void SetResolveUsers(AdminAuditLogSearch searchObject, DataAccessHelper.GetDataObjectDelegate getDataObject, Task.TaskVerboseLoggingDelegate writeVerbose, Task.TaskWarningLoggingDelegate writeWarning)
 {
     if (searchObject.UserIdsUserInput != null && searchObject.UserIdsUserInput.Count > 0)
     {
         writeVerbose(Strings.VerboseStartResolvingUsers);
         ADObjectId        rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
         ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, searchObject.OrganizationId, null, false);
         IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.PartiallyConsistent, sessionSettings, 515, "SetResolveUsers", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\AdminAuditLog\\AdminAuditLogHelper.cs");
         tenantOrRootOrgRecipientSession.UseConfigNC = false;
         searchObject.UserIds       = new MultiValuedProperty <string>();
         searchObject.ResolvedUsers = new MultiValuedProperty <string>();
         foreach (SecurityPrincipalIdParameter securityPrincipalIdParameter in searchObject.UserIdsUserInput)
         {
             searchObject.UserIds.Add(securityPrincipalIdParameter.RawIdentity);
             bool flag = false;
             try
             {
                 ADRecipient adrecipient = (ADRecipient)getDataObject(securityPrincipalIdParameter, tenantOrRootOrgRecipientSession, null, null, new LocalizedString?(Strings.WarningSearchUserNotFound(securityPrincipalIdParameter.ToString())), new LocalizedString?(Strings.ErrorSearchUserNotUnique(securityPrincipalIdParameter.ToString())));
                 if (adrecipient.Id != null && adrecipient.Id.DomainId != null && !string.IsNullOrEmpty(adrecipient.Id.DomainId.Name))
                 {
                     string text = (string)adrecipient.propertyBag[IADSecurityPrincipalSchema.SamAccountName];
                     if (!string.IsNullOrEmpty(text))
                     {
                         searchObject.ResolvedUsers.Add(adrecipient.Id.DomainId.Name + "\\" + text);
                         flag = true;
                         writeVerbose(Strings.DebugResolvingDomainAccount(securityPrincipalIdParameter.ToString(), adrecipient.Id.DomainId.Name, text));
                     }
                 }
                 if (adrecipient.propertyBag[IADSecurityPrincipalSchema.Sid] != null)
                 {
                     string value = ((SecurityIdentifier)adrecipient.propertyBag[IADSecurityPrincipalSchema.Sid]).Value;
                     if (!string.IsNullOrEmpty(value))
                     {
                         searchObject.ResolvedUsers.Add(value);
                         flag = true;
                         writeVerbose(Strings.DebugResolvingUserSid(securityPrincipalIdParameter.ToString(), value));
                     }
                 }
                 if (adrecipient.Id != null && !string.IsNullOrEmpty(adrecipient.Id.ToString()))
                 {
                     searchObject.ResolvedUsers.Add(adrecipient.Id.ToString());
                     flag = true;
                     writeVerbose(Strings.DebugResolvingUserCN(securityPrincipalIdParameter.ToString(), adrecipient.Id.ToString()));
                 }
                 if (!flag)
                 {
                     writeWarning(Strings.WarningCannotResolveUser(securityPrincipalIdParameter.ToString()));
                     searchObject.ResolvedUsers.Add(securityPrincipalIdParameter.ToString());
                 }
             }
             catch (ManagementObjectNotFoundException)
             {
                 writeWarning(Strings.WarningSearchUserNotFound(securityPrincipalIdParameter.ToString()));
                 searchObject.ResolvedUsers.Add(securityPrincipalIdParameter.ToString());
             }
         }
     }
 }
Esempio n. 12
0
        public static IConfigurationSession CreateOrganizationFindingSession(OrganizationId currentOrgId, OrganizationId executingUserOrgId)
        {
            ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(null, null);
            ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, currentOrgId, executingUserOrgId, true);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantSubTree, 643, "CreateOrganizationFindingSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxReplication\\RequestBase\\RequestTaskHelper.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = false;
            return(tenantOrTopologyConfigurationSession);
        }
Esempio n. 13
0
        private IConfigurationSession CreateScopedSession(ExchangeConfigurationUnit cu)
        {
            ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, null);
            ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, cu.OrganizationId, base.ExecutingUserOrganizationId, false);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, sessionSettings, 473, "CreateScopedSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\EdgeSync\\TestEdgeSyncEhf.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = true;
            return(tenantOrTopologyConfigurationSession);
        }
Esempio n. 14
0
        static Canary()
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 585, ".cctor", "f:\\15.00.1497\\sources\\dev\\admin\\src\\ecp\\Utilities\\Canary.cs");

            byte[] array  = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().ObjectGuid.ToByteArray();
            byte[] array2 = topologyConfigurationSession.GetDatabasesContainerId().ObjectGuid.ToByteArray();
            Canary.adObjectIdsBinary = new byte[array.Length + array2.Length];
            array.CopyTo(Canary.adObjectIdsBinary, 0);
            array2.CopyTo(Canary.adObjectIdsBinary, array.Length);
        }
        protected override IConfigDataProvider CreateSession()
        {
            ADObjectId            rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, base.CurrentOrganizationId ?? base.ExecutingUserOrganizationId, base.ExecutingUserOrganizationId, true);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 133, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\TenantMonitoring\\TestExchangeNotification.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC      = true;
            tenantOrTopologyConfigurationSession.UseGlobalCatalog = false;
            return(tenantOrTopologyConfigurationSession);
        }
Esempio n. 16
0
        private static ADObjectId GetRootOrgContainerIdForLocalForest()
        {
            ADObjectId rootOrgContainerIdForLocalForest = null;

            ADNotificationAdapter.RunADOperation(delegate()
            {
                rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            });
            return(rootOrgContainerIdForLocalForest);
        }
Esempio n. 17
0
        public void RegisterForSubmissionServiceEvents()
        {
            if (!this.NeedExplicitDeletedObjectSubscription)
            {
                return;
            }
            ADObjectId descendantId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest().GetDescendantId(InterceptorRule.InterceptorRulesContainer);

            this.RegisterChangeNotificationForDeletedObject <InterceptorRule>(descendantId, new ADNotificationCallback(this.HandleInterceptorRuleDeleted));
        }
Esempio n. 18
0
        protected OrganizationId ResolveCurrentOrganization()
        {
            ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(base.DomainController, string.IsNullOrEmpty(base.DomainController) ? null : base.NetCredential);
            ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 179, "ResolveCurrentOrganization", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Migration\\RemoveMigrationObjectTaskBase.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = false;
            ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(this.Organization, tenantOrTopologyConfigurationSession, null, new LocalizedString?(Strings.ErrorOrganizationNotFound(this.Organization.ToString())), new LocalizedString?(Strings.ErrorOrganizationNotUnique(this.Organization.ToString())));

            return(adorganizationalUnit.OrganizationId);
        }
        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);
        }
Esempio n. 20
0
        private OrganizationId ResolveCurrentOrganization()
        {
            ADObjectId            rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, 362, "ResolveCurrentOrganization", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Migration\\ExportMigrationReport.cs");

            tenantOrTopologyConfigurationSession.UseConfigNC = false;
            ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(this.Organization, tenantOrTopologyConfigurationSession, null, new LocalizedString?(Strings.ErrorOrganizationNotFound(this.Organization.ToString())), new LocalizedString?(Strings.ErrorOrganizationNotUnique(this.Organization.ToString())));

            return(adorganizationalUnit.OrganizationId);
        }
Esempio n. 21
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     this.LoadSupportedToolsData();
     this.tenantVersionRequired = this.toolsData.RequiresTenantVersion();
     if (this.tenantVersionRequired)
     {
         this.rootOrgContainerId    = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
         base.CurrentOrganizationId = OrganizationTaskHelper.ResolveOrganization(this, this.Organization, this.rootOrgContainerId, Strings.ErrorOrganizationParameterRequired);
     }
 }
Esempio n. 22
0
 internal virtual ADObjectId GetRootOrgContainerId(PartitionId partitionId)
 {
     if (partitionId == null)
     {
         throw new ArgumentNullException("partitionId");
     }
     if (ADSession.IsBoundToAdam || partitionId.IsLocalForestPartition())
     {
         return(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest());
     }
     return(ADSystemConfigurationSession.GetRootOrgContainerId(partitionId.ForestFQDN, null, null));
 }
Esempio n. 23
0
        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));
        }
Esempio n. 24
0
 public static ADSessionSettings ToADSessionSettings(this OrganizationId organizationId)
 {
     if (organizationId == null || organizationId == OrganizationId.ForestWideOrgId)
     {
         return(ADSessionSettings.FromRootOrgScopeSet());
     }
     if (DirectoryExtensions.ServicesRootOrgId == null)
     {
         DirectoryExtensions.ServicesRootOrgId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
     }
     return(ADSessionSettings.FromOrganizationIdWithoutRbacScopes(DirectoryExtensions.ServicesRootOrgId, organizationId, null, false));
 }
Esempio n. 25
0
        private IConfigurationSession GetDialPlanSession()
        {
            IConfigurationSession result = (IConfigurationSession)base.DataSession;

            if (this.SharedUMDialPlan)
            {
                ADObjectId        rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
                ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
                result = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 167, "GetDialPlanSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxPolicies\\UMMailboxPolicyTask.cs");
            }
            return(result);
        }
Esempio n. 26
0
        public static IConfigurationSession CreateSession(OrganizationId organizationId, string configurationDomainController)
        {
            ADObjectId        rootOrgContainerIdForLocalForest = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            ADSessionSettings adsessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerIdForLocalForest, organizationId, null, false);

            if (adsessionSettings == null)
            {
                AdminAuditLogHelper.Tracer.TraceError(0L, "AdminAuditLogHelper: adSessionSettings is null. Cannot get config objects from AD.");
                throw new ArgumentNullException("adSessionSettings is null");
            }
            return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(configurationDomainController, true, ConsistencyMode.FullyConsistent, adsessionSettings, 133, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\AdminAuditLog\\AdminAuditLogHelper.cs"));
        }
Esempio n. 27
0
 protected override void InternalBeginProcessing()
 {
     base.InternalBeginProcessing();
     if (this.Organization != null)
     {
         ADObjectId            rootOrgContainerId = ADSystemConfigurationSession.GetRootOrgContainerId(this.DomainController, null);
         ADSessionSettings     sessionSettings    = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(rootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true);
         IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.PartiallyConsistent, null, sessionSettings, ConfigScopes.TenantSubTree, 105, "InternalBeginProcessing", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\rms\\SetRmsTemplate.cs");
         tenantOrTopologyConfigurationSession.UseConfigNC = false;
         ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(this.Organization, tenantOrTopologyConfigurationSession, null, new LocalizedString?(Strings.ErrorOrganizationNotFound(this.Organization.ToString())), new LocalizedString?(Strings.ErrorOrganizationNotUnique(this.Organization.ToString())));
         base.CurrentOrganizationId = adorganizationalUnit.OrganizationId;
     }
 }
        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);
        }
Esempio n. 29
0
        private IPowerShellBudget GetBudget(HttpContext context)
        {
            if (context.User is DelegatedPrincipal)
            {
                using (new MonitoredScope("ThrottlingHttpModule", "AcquireDelegatedPrincipalBudget", HttpModuleHelper.HttpPerfMonitors))
                {
                    return(PowerShellBudget.Acquire(new DelegatedPrincipalBudgetKey((DelegatedPrincipal)context.User, BudgetType.WSMan)));
                }
            }
            if (context.CurrentUserToken() == null)
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] No CAT.");
                return(null);
            }
            SecurityIdentifier userSid = context.CurrentUserToken().UserSid;

            if (userSid == null)
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] sid = null.");
                return(null);
            }
            OrganizationId organization = context.CurrentUserToken().Organization;

            if (organization == null)
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] orgId = null.");
                return(null);
            }
            ADObjectId adobjectId;

            if (organization.Equals(OrganizationId.ForestWideOrgId))
            {
                ExTraceGlobals.HttpModuleTracer.TraceDebug((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] Forest Wide Org Id.");
                adobjectId = ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest();
            }
            else
            {
                adobjectId = ADSystemConfigurationSession.GetRootOrgContainerId(organization.PartitionId.ForestFQDN, null, null);
            }
            ExTraceGlobals.HttpModuleTracer.TraceDebug <string>((long)this.GetHashCode(), "[ThrottlingHttpModule::GetBudget] rootOrgId = {0}.", (adobjectId == null) ? null : adobjectId.DistinguishedName);
            IPowerShellBudget result;

            using (new MonitoredScope("ThrottlingHttpModule", "AcquireBudget", HttpModuleHelper.HttpPerfMonitors))
            {
                result = PowerShellBudget.Acquire(userSid, BudgetType.WSMan, ADSessionSettings.FromOrganizationIdWithoutRbacScopes(adobjectId, organization, organization, true));
            }
            return(result);
        }
        private static void GetQueryParameters(IRecipientSession session, out ADObjectId rootId, out QueryScope queryScope)
        {
            rootId     = null;
            queryScope = QueryScope.SubTree;
            OrganizationId currentOrganizationId = session.SessionSettings.CurrentOrganizationId;
            ConfigScopes   configScopes          = session.SessionSettings.ConfigScopes;

            if (currentOrganizationId == OrganizationId.ForestWideOrgId && OrganizationMailbox.IsScopeLimitedToFirstOrg(configScopes) && OrganizationMailbox.IsMultiTenantEnvironment())
            {
                ExTraceGlobals.StorageTracer.TraceDebug(0L, "Scoping search to First Org Users container in datacenter");
                rootId     = ADSystemConfigurationSession.GetFirstOrgUsersContainerId();
                queryScope = QueryScope.OneLevel;
                return;
            }
            ExTraceGlobals.StorageTracer.TraceDebug(0L, "Scoping search to rootId null");
        }