Example #1
0
            internal virtual ADSessionSettings FromOrganizationIdWithoutRbacScopes(ADObjectId rootOrgId, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId, bool scopeToExecutingUserOrgId, bool allowRehoming)
            {
                if (rootOrgId == null)
                {
                    throw new ArgumentNullException("rootOrgId");
                }
                if (null == currentOrganizationId)
                {
                    throw new ArgumentNullException("currentOrganizationId");
                }
                if (scopeToExecutingUserOrgId && executingUserOrganizationId == null)
                {
                    throw new ArgumentException("scopeToExecutingUserOrgId + null executingUserOrganizationId");
                }
                if (allowRehoming)
                {
                    currentOrganizationId       = this.RehomeScopingOrganizationIdIfNeeded(currentOrganizationId);
                    executingUserOrganizationId = this.RehomeScopingOrganizationIdIfNeeded(executingUserOrganizationId);
                }
                OrganizationId organizationId = currentOrganizationId;

                if (scopeToExecutingUserOrgId)
                {
                    organizationId = executingUserOrganizationId;
                }
                ScopeSet     orgWideDefaultScopeSet = ScopeSet.GetOrgWideDefaultScopeSet(organizationId);
                ConfigScopes configScopes           = ConfigScopes.TenantLocal;

                return(ADSessionSettings.SessionSettingsFactory.CreateADSessionSettings(orgWideDefaultScopeSet, rootOrgId, currentOrganizationId, executingUserOrganizationId, configScopes, (currentOrganizationId.PartitionId != null) ? currentOrganizationId.PartitionId : (Globals.IsMicrosoftHostedOnly ? rootOrgId.GetPartitionId() : null)));
            }
 // Token: 0x06000F9C RID: 3996 RVA: 0x0004A7CC File Offset: 0x000489CC
 public ObjectScopeAttribute(ConfigScopes configScope)
 {
     if (configScope == ConfigScopes.None)
     {
         throw new ArgumentOutOfRangeException("configScope", "'None' is not a valid ConfigScope.");
     }
     this.mainConfigScope  = configScope;
     this.applicableScopes = new ConfigScopes[]
     {
         configScope
     };
 }
Example #3
0
            internal ADSessionSettings FromCustomScopeSet(ScopeSet scopeSet, ADObjectId rootOrgId, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId, bool allowRehoming = true)
            {
                if (rootOrgId == null)
                {
                    throw new ArgumentNullException("rootOrgId");
                }
                ConfigScopes configScopes = ConfigScopes.TenantLocal;

                if (allowRehoming)
                {
                    currentOrganizationId       = this.RehomeScopingOrganizationIdIfNeeded(currentOrganizationId);
                    executingUserOrganizationId = this.RehomeScopingOrganizationIdIfNeeded(executingUserOrganizationId);
                }
                return(ADSessionSettings.SessionSettingsFactory.CreateADSessionSettings(scopeSet, rootOrgId, currentOrganizationId, executingUserOrganizationId, configScopes, currentOrganizationId.PartitionId));
            }
        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");
        }
 // Token: 0x060008A9 RID: 2217 RVA: 0x0002708A File Offset: 0x0002528A
 public override IRootOrganizationRecipientSession CreateRootOrgRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScopes, int callerFileLine, string memberName, string callerFilePath)
 {
     throw new NotImplementedException();
 }
        // Token: 0x060008A8 RID: 2216 RVA: 0x00027068 File Offset: 0x00025268
        public override ITenantRecipientSession CreateTenantRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScopes, int callerFileLine, string memberName, string callerFilePath)
        {
            CacheDirectorySession cacheDirectorySession = new CacheDirectorySession(sessionSettings);

            cacheDirectorySession.SetCallerInfo(callerFilePath, memberName, callerFileLine);
            return(cacheDirectorySession);
        }
 // Token: 0x060008A6 RID: 2214 RVA: 0x0002703B File Offset: 0x0002523B
 public override ITopologyConfigurationSession CreateTopologyConfigurationSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, int callerFileLine, string memberName, string callerFilePath)
 {
     throw new NotImplementedException();
 }
 public ADTenantConfigurationSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope) : this(domainController, readOnly, consistencyMode, networkCredential, sessionSettings)
 {
     if (ConfigScopes.TenantSubTree != configScope)
     {
         throw new NotSupportedException("Only ConfigScopes.TenantSubTree is supported by this constructor");
     }
     if (ConfigScopes.TenantSubTree == configScope)
     {
         base.ConfigScope = configScope;
     }
 }
        // Token: 0x0600061F RID: 1567 RVA: 0x000212C4 File Offset: 0x0001F4C4
        public override ITenantConfigurationSession CreateTenantConfigurationSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, int callerFileLine, string memberName, string callerFilePath)
        {
            ADTenantConfigurationSession adtenantConfigurationSession = new ADTenantConfigurationSession(domainController, readOnly, consistencyMode, networkCredential, sessionSettings, configScope);

            adtenantConfigurationSession.SetCallerInfo(callerFilePath, memberName, callerFileLine);
            return(adtenantConfigurationSession);
        }
Example #10
0
 public override ITenantRecipientSession CreateTenantRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, int callerFileLine, string memberName, string callerFilePath)
 {
     return(new FfoTenantRecipientSession(true, readOnly, consistencyMode, networkCredential, sessionSettings));
 }
        ADScope IDirectorySession.GetReadScope(ADObjectId rootId, ADRawEntry scopeDeterminingObject, bool isWellKnownGuidSearch, out ConfigScopes applicableScope)
        {
            TSession session = this.GetSession();

            return(session.GetReadScope(rootId, scopeDeterminingObject, isWellKnownGuidSearch, out applicableScope));
        }
        public override ITenantRecipientSession CreateTenantRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScopes, int callerFileLine, string memberName, string callerFilePath)
        {
            bool cacheSessionForDeletingOnly = true;

            if (networkCredential == null && string.IsNullOrEmpty(domainController))
            {
                cacheSessionForDeletingOnly = false;
            }
            return(new CompositeTenantRecipientSession(DirectorySessionFactory.CacheSessionFactory.CreateTenantRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScopes, callerFileLine, memberName, callerFilePath), DirectorySessionFactory.NonCacheSessionFactory.CreateTenantRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScopes, callerFileLine, memberName, callerFilePath), cacheSessionForDeletingOnly));
        }
Example #13
0
 public IRecipientSession GetTenantOrRootOrgRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, [CallerLineNumber] int callerFileLine = 0, [CallerMemberName] string memberName = null, [CallerFilePath] string callerFilePath = null)
 {
     if (sessionSettings.CurrentOrganizationId == OrganizationId.ForestWideOrgId && sessionSettings.ConfigScopes != ConfigScopes.AllTenants)
     {
         return(this.CreateRootOrgRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScope, callerFileLine, memberName, callerFilePath));
     }
     return(this.CreateTenantRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScope, callerFileLine, memberName, callerFilePath));
 }
Example #14
0
        internal static bool TryVerifyIsWithinScopes(ADRawEntry obj, ADScope readScope, IList <ADScopeCollection> writeScopes, ADScopeCollection exclusiveScopes, IList <ValidationRule> validationRules, bool emptyObjectSessionOnException, ConfigScopes sessionScopeHint, out ADScopeException exception)
        {
            if (readScope == null)
            {
                throw new ArgumentNullException("readScope");
            }
            if (writeScopes == null)
            {
                throw new ArgumentNullException("writeScopes");
            }
            exception = null;
            bool flag;

            if (!ADSession.IsWithinScope(obj, readScope, out flag))
            {
                if (!flag || sessionScopeHint != ConfigScopes.RootOrg || ADSession.IsTenantIdentity(obj.Id, obj.Id.GetPartitionId().ForestFQDN))
                {
                    if (obj is ADObject && emptyObjectSessionOnException)
                    {
                        ((ADObject)obj).m_Session = null;
                    }
                    exception = new ADScopeException(DirectoryStrings.ErrorNotInReadScope(obj.Id.ToString()));
                    return(false);
                }
                ExTraceGlobals.ScopeVerificationTracer.TraceDebug <ADObjectId>(0L, "ADSession::TryVerifyIsWithinScopes Allowing unfilterable object '{0}' in RootOrg-scoped session to bypass filter verification", obj.Id);
            }
            bool flag2 = false;

            if (exclusiveScopes != null)
            {
                foreach (ADScope scope in exclusiveScopes)
                {
                    if (ADSession.IsWithinScope(obj, scope))
                    {
                        flag2 = true;
                        break;
                    }
                }
            }
            foreach (ADScopeCollection adscopeCollection in writeScopes)
            {
                bool flag3 = false;
                foreach (ADScope adscope in adscopeCollection)
                {
                    bool flag4 = false;
                    bool flag5 = false;
                    bool flag6 = false;
                    if (adscope is RbacScope)
                    {
                        RbacScope rbacScope = (RbacScope)adscope;
                        flag4 = rbacScope.Exclusive;
                        flag5 = rbacScope.IsFromEndUserRole;
                        flag6 = (rbacScope.ScopeType == ScopeType.Self);
                    }
                    if (!flag2 && flag4)
                    {
                        ExTraceGlobals.ScopeVerificationTracer.TraceDebug(0L, "ADSession::TryVerifyIsWithinScopes Ignoring scope ScopeRoot '{0}', ScopeFilter '{1}', IsWithinExclusiveScope '{2}', IsExclusive '{3}'", new object[]
                        {
                            (adscope.Root == null) ? "<null>" : adscope.Root.ToDNString(),
                            (adscope.Filter == null) ? "<null>" : adscope.Filter.ToString(),
                            flag2,
                            flag4
                        });
                    }
                    else
                    {
                        ADScope adscope2 = adscope;
                        if (flag2 && !flag4)
                        {
                            if (!flag5)
                            {
                                ExTraceGlobals.ScopeVerificationTracer.TraceDebug(0L, "ADSession::TryVerifyIsWithinScopes Ignoring scope ScopeRoot '{0}', ScopeFilter '{1}', IsWithinExclusiveScope '{2}', IsExclusive '{3}'", new object[]
                                {
                                    (adscope2.Root == null) ? "<null>" : adscope2.Root.ToDNString(),
                                    (adscope2.Filter == null) ? "<null>" : adscope2.Filter.ToString(),
                                    flag2,
                                    flag4
                                });
                                continue;
                            }
                            if (!flag6)
                            {
                                if (((RbacScope)adscope2).SelfFilter == null)
                                {
                                    exception = new ADScopeException(DirectoryStrings.ExArgumentNullException("RbacScope.SelfFilter"));
                                    return(false);
                                }
                                adscope2 = new RbacScope(ScopeType.Self)
                                {
                                    Root   = ((RbacScope)adscope2).SelfRoot,
                                    Filter = ((RbacScope)adscope2).SelfFilter
                                };
                            }
                        }
                        if (ADSession.IsWithinScope(obj, adscope2))
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
                if (!flag3)
                {
                    if (obj is ADObject && emptyObjectSessionOnException)
                    {
                        ((ADObject)obj).m_Session = null;
                    }
                    exception = new ADScopeException(DirectoryStrings.ErrorNoWriteScope(obj.Id.ToString()));
                    return(false);
                }
            }
            if (validationRules != null)
            {
                RuleValidationException ex = null;
                foreach (ValidationRule validationRule in validationRules)
                {
                    if (!validationRule.TryValidate(obj, out ex))
                    {
                        exception = ex;
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #15
0
 public IRecipientSession GetTenantOrRootOrgRecipientSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, [CallerLineNumber] int callerFileLine = 0, [CallerMemberName] string memberName = null, [CallerFilePath] string callerFilePath = null)
 {
     return(this.GetTenantOrRootOrgRecipientSession(domainController, null, CultureInfo.CurrentCulture.LCID, readOnly, consistencyMode, networkCredential, sessionSettings, configScope, callerFileLine, memberName, callerFilePath));
 }
Example #16
0
 public abstract IRootOrganizationRecipientSession CreateRootOrgRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScopes, [CallerLineNumber] int callerFileLine = 0, [CallerMemberName] string memberName = null, [CallerFilePath] string callerFilePath = null);
Example #17
0
 public abstract ITopologyConfigurationSession CreateTopologyConfigurationSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, [CallerLineNumber] int callerFileLine = 0, [CallerMemberName] string memberName = null, [CallerFilePath] string callerFilePath = null);
        // Token: 0x06000626 RID: 1574 RVA: 0x00021400 File Offset: 0x0001F600
        public override ITenantRecipientSession CreateTenantRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, int callerFileLine, string memberName, string callerFilePath)
        {
            DirectorySessionBase directorySessionBase = ADSessionFactory.UseAggregateSession(sessionSettings) ? new AggregateTenantRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScope) : new ADTenantRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScope);

            directorySessionBase.SetCallerInfo(callerFilePath, memberName, callerFileLine);
            return((ITenantRecipientSession)directorySessionBase);
        }
Example #19
0
 private ADSessionSettings(ScopeSet scopeSet, ADObjectId rootOrgId, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId, ConfigScopes configScopes, PartitionId partitionId)
 {
     if (scopeSet == null)
     {
         throw new ArgumentNullException("scopeSet");
     }
     if (null == currentOrganizationId)
     {
         throw new ArgumentNullException("currentOrganizationId");
     }
     if (executingUserOrganizationId != null && !executingUserOrganizationId.Equals(OrganizationId.ForestWideOrgId) && !executingUserOrganizationId.Equals(currentOrganizationId) && !currentOrganizationId.OrganizationalUnit.IsDescendantOf(executingUserOrganizationId.OrganizationalUnit))
     {
         throw new ArgumentException(DirectoryStrings.ErrorInvalidExecutingOrg(executingUserOrganizationId.OrganizationalUnit.DistinguishedName, currentOrganizationId.OrganizationalUnit.DistinguishedName));
     }
     if (partitionId == null)
     {
         throw new ArgumentNullException("partitionId");
     }
     this.scopeSet                    = scopeSet;
     this.preferredServers            = new SimpleServerSettings();
     this.rootOrgId                   = rootOrgId;
     this.currentOrganizationId       = currentOrganizationId;
     this.executingUserOrganizationId = executingUserOrganizationId;
     this.configScopes                = configScopes;
     this.partitionId                 = partitionId;
     this.tenantConsistencyMode       = ((configScopes == ConfigScopes.AllTenants) ? TenantConsistencyMode.IgnoreRetiredTenants : TenantConsistencyMode.ExpectOnlyLiveTenants);
     if (!ADGlobalConfigSettings.SoftLinkEnabled || this.PartitionId == null || this.PartitionId.IsLocalForestPartition() || ADSessionSettings.IsForefrontObject(this.PartitionId))
     {
         this.PartitionSoftLinkMode = SoftLinkMode.Disabled;
         return;
     }
     if (this.PartitionId.ForestFQDN.EndsWith(TopologyProvider.LocalForestFqdn, StringComparison.OrdinalIgnoreCase))
     {
         this.PartitionSoftLinkMode = SoftLinkMode.Disabled;
         return;
     }
     if (this.ConfigScopes == ConfigScopes.Database || this.ConfigScopes == ConfigScopes.Server || this.ConfigScopes == ConfigScopes.RootOrg)
     {
         this.PartitionSoftLinkMode = SoftLinkMode.Disabled;
         return;
     }
     this.PartitionSoftLinkMode = SoftLinkMode.DualMatch;
 }
        // Token: 0x06000627 RID: 1575 RVA: 0x00021450 File Offset: 0x0001F650
        public override IRootOrganizationRecipientSession CreateRootOrgRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, int callerFileLine, string memberName, string callerFilePath)
        {
            ADRootOrganizationRecipientSession adrootOrganizationRecipientSession = new ADRootOrganizationRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScope);

            adrootOrganizationRecipientSession.SetCallerInfo(callerFilePath, memberName, callerFileLine);
            return(adrootOrganizationRecipientSession);
        }
 private static bool IsScopeLimitedToFirstOrg(ConfigScopes configScope)
 {
     return(configScope == ConfigScopes.RootOrg || configScope == ConfigScopes.TenantLocal || configScope == ConfigScopes.TenantSubTree || configScope == ConfigScopes.Global);
 }
 public override ITopologyConfigurationSession CreateTopologyConfigurationSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, int callerFileLine, string memberName, string callerFilePath)
 {
     return(DirectorySessionFactory.NonCacheSessionFactory.CreateTopologyConfigurationSession(domainController, readOnly, consistencyMode, networkCredential, sessionSettings, configScope, callerFileLine, memberName, callerFilePath));
 }
Example #23
0
 public override ITenantConfigurationSession CreateTenantConfigurationSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope, int callerFileLine, string memberName, string callerFilePath)
 {
     return(new FfoTenantConfigurationSession(domainController, readOnly, consistencyMode, networkCredential, sessionSettings, configScope));
 }
 public override IRootOrganizationRecipientSession CreateRootOrgRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScopes, int callerFileLine, string memberName, string callerFilePath)
 {
     return(DirectorySessionFactory.NonCacheSessionFactory.CreateRootOrgRecipientSession(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings, configScopes, callerFileLine, memberName, callerFilePath));
 }
 // Token: 0x06000F9E RID: 3998 RVA: 0x0004A828 File Offset: 0x00048A28
 public bool HasApplicableConfigScope(ConfigScopes configScope)
 {
     return(Array.Exists <ConfigScopes>(this.applicableScopes, (ConfigScopes s) => s == configScope));
 }
 public ADTenantRecipientSession(string domainController, ADObjectId searchRoot, int lcid, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope) : this(domainController, searchRoot, lcid, readOnly, consistencyMode, networkCredential, sessionSettings)
 {
     base.CheckConfigScopeParameter(configScope);
     base.ConfigScope = configScope;
 }
Example #27
0
 ADScope IDirectorySession.GetReadScope(ADObjectId rootId, ADRawEntry scopeDeterminingObject, bool isWellKnownGuidSearch, out ConfigScopes applicableScope)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
     applicableScope = ConfigScopes.AllTenants;
     return(new ADScope(rootId, null));
 }
Example #28
0
            protected static ADSessionSettings CreateADSessionSettings(ScopeSet scopeSet, ADObjectId rootOrgId, OrganizationId currentOrganizationId, OrganizationId executingUserOrganizationId, ConfigScopes configScopes, PartitionId partitionId)
            {
                ADSessionSettings adsessionSettings = new ADSessionSettings(scopeSet, rootOrgId, currentOrganizationId, executingUserOrganizationId, configScopes, partitionId);

                if (ADSessionSettings.SessionSettingsFactory.ThreadPostActionForSettings == null)
                {
                    return(adsessionSettings);
                }
                return(ADSessionSettings.SessionSettingsFactory.ThreadPostActionForSettings(adsessionSettings));
            }
		public FfoTopologyConfigurationSession(string domainController, bool readOnly, ConsistencyMode consistencyMode, NetworkCredential networkCredential, ADSessionSettings sessionSettings, ConfigScopes configScope) : this(domainController, readOnly, consistencyMode, networkCredential, sessionSettings)
		{
			base.ConfigScope = configScope;
		}