internal UMDialPlan GetDialPlan() { ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(this.UMDialPlan); IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, true, ConsistencyMode.IgnoreInvalid, null, sessionSettings, 2111, "GetDialPlan", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\umautoattendantconfig.cs"); return(tenantOrTopologyConfigurationSession.Read <UMDialPlan>(this.UMDialPlan)); }
internal static UMAutoAttendant FindAutoAttendantByPilotIdentifierAndDialPlan(string pilotIdentifier, ADObjectId dialPlanId) { if (pilotIdentifier == null) { throw new ArgumentNullException("pilotIdentifier"); } if (dialPlanId == null) { throw new ArgumentNullException("dialPlanId"); } ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(dialPlanId); IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 2144, "FindAutoAttendantByPilotIdentifierAndDialPlan", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\umautoattendantconfig.cs"); QueryFilter filter = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, UMAutoAttendantSchema.PilotIdentifierList, pilotIdentifier), new ComparisonFilter(ComparisonOperator.Equal, UMAutoAttendantSchema.UMDialPlan, dialPlanId) }); UMAutoAttendant[] array = tenantOrTopologyConfigurationSession.Find <UMAutoAttendant>(null, QueryScope.SubTree, filter, null, 0); switch (array.Length) { case 0: return(null); case 1: return(array[0]); default: throw new NonUniquePilotIdentifierException(pilotIdentifier, dialPlanId.ToString()); } }
internal static bool IsPrecannedRoleGroup(ADGroup roleGroup, IConfigurationSession configurationSession, params Guid[] cannedRoleGroups) { if (roleGroup == null) { throw new ArgumentNullException("roleGroup"); } if (configurationSession == null) { throw new ArgumentNullException("configurationSession"); } ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(roleGroup.OrganizationId); IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(configurationSession.DomainController, true, configurationSession.ConsistencyMode, configurationSession.NetworkCredential, sessionSettings, 351, "IsPrecannedRoleGroup", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RBAC\\RoleGroup\\RoleGroupCommon.cs"); List <DNWithBinary> source = roleGroup.OrganizationId.Equals(OrganizationId.ForestWideOrgId) ? tenantOrTopologyConfigurationSession.GetExchangeConfigurationContainer().OtherWellKnownObjects.ToList <DNWithBinary>() : tenantOrTopologyConfigurationSession.Read <ExchangeConfigurationUnit>(roleGroup.OrganizationId.ConfigurationUnit).OtherWellKnownObjects.ToList <DNWithBinary>(); List <RoleGroupDefinition> list; if (cannedRoleGroups != null && cannedRoleGroups.Length > 0) { list = (from rgDefinition in RoleGroupDefinitions.RoleGroups where cannedRoleGroups.Contains(rgDefinition.RoleGroupGuid) select rgDefinition).ToList <RoleGroupDefinition>(); } else { list = RoleGroupDefinitions.RoleGroups.ToList <RoleGroupDefinition>(); } foreach (RoleGroupDefinition roleGroupDefinition in list) { DNWithBinary value = new DNWithBinary(roleGroup.Id.DistinguishedName, roleGroupDefinition.RoleGroupGuid.ToByteArray()); if (source.Contains(value)) { return(true); } } return(false); }
private static ThrottlingPolicy ReadOrganizationThrottlingPolicyFromAD(OrganizationId orgId) { SharedConfiguration sharedConfiguration = SharedConfiguration.GetSharedConfiguration(orgId); if (sharedConfiguration != null) { orgId = sharedConfiguration.SharedConfigId; } ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(orgId); IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, sessionSettings, 224, "ReadOrganizationThrottlingPolicyFromAD", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\throttling\\EffectiveThrottlingPolicy.cs"); tenantOrTopologyConfigurationSession.SessionSettings.IsSharedConfigChecked = true; return(tenantOrTopologyConfigurationSession.GetOrganizationThrottlingPolicy(orgId)); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); TDataObject dataObject = this.DataObject; ADObjectId parent = dataObject.Id.Parent; ADSessionSettings adsessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(parent); if (!parent.Equals(ADSession.GetRootDomainNamingContext(adsessionSettings.GetAccountOrResourceForestFqdn()))) { IDirectorySession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, adsessionSettings, 264, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\NewAdObjectTask.cs"); tenantOrTopologyConfigurationSession.UseConfigNC = ((IDirectorySession)base.DataSession).UseConfigNC; ADRawEntry adrawEntry = tenantOrTopologyConfigurationSession.ReadADRawEntry(parent, new PropertyDefinition[] { ADObjectSchema.ExchangeVersion, ADObjectSchema.ObjectClass }); if (adrawEntry == null) { if (string.IsNullOrEmpty(base.DomainController)) { TDataObject dataObject2 = this.DataObject; base.WriteError(new TaskException(Strings.ErrorParentNotFound(dataObject2.Name, parent.ToString())), (ErrorCategory)1003, null); } else { TDataObject dataObject3 = this.DataObject; base.WriteError(new TaskException(Strings.ErrorParentNotFoundOnDomainController(dataObject3.Name, base.DomainController, parent.ToString(), parent.DomainId.ToString())), (ErrorCategory)1003, null); } } ExchangeObjectVersion exchangeObjectVersion = (ExchangeObjectVersion)adrawEntry[ADObjectSchema.ExchangeVersion]; MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)adrawEntry[ADObjectSchema.ObjectClass]; TDataObject dataObject4 = this.DataObject; if (dataObject4.ExchangeVersion.IsOlderThan(exchangeObjectVersion) && !multiValuedProperty.Contains(Organization.MostDerivedClass) && this.EnforceExchangeObjectVersion) { TDataObject dataObject5 = this.DataObject; string name = dataObject5.Name; TDataObject dataObject6 = this.DataObject; base.WriteError(new TaskException(Strings.ErrorParentHasNewerVersion(name, dataObject6.ExchangeVersion.ToString(), exchangeObjectVersion.ToString())), (ErrorCategory)1004, null); } } if (base.IsVerboseOn) { base.WriteVerbose(TaskVerboseStringHelper.GetConfigurableObjectChangedProperties(this.DataObject)); } base.InternalProcessRecord(); TaskLogger.LogExit(); }
// Token: 0x06001476 RID: 5238 RVA: 0x0004C1F4 File Offset: 0x0004A3F4 protected override ADObjectId[] GetNestedSecurityGroupMembership(ADRawEntry user) { OrganizationId organizationId = (OrganizationId)user[ADObjectSchema.OrganizationId]; if (organizationId != null) { ExTraceGlobals.RunspaceConfigTracer.TraceDebug(0L, "[RwsExchangeRunspaceConfiguration::GetNestedSecurityGroupMembership] Create ADSessionSettings from OrgId!"); using (new MonitoredScope("ExchangeRunspaceConfiguration", "GetNestedSecurityGroupMembership", AuthZLogHelper.AuthZPerfMonitors)) { ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(organizationId); IRecipientSession tenantOrRootOrgRecipientSession; using (new MonitoredScope("ExchangeRunspaceConfiguration", "GetNestedSecurityGroupMembership.GetTenantOrRootOrgRecipientSession", AuthZLogHelper.AuthZPerfMonitors)) { tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 101, "GetNestedSecurityGroupMembership", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\rbac\\RwsExchangeRunspaceConfiguration.cs"); } return(ExchangeRunspaceConfiguration.GetNestedSecurityGroupMembership(user, tenantOrRootOrgRecipientSession, AssignmentMethod.All)); } } ExTraceGlobals.RunspaceConfigTracer.TraceDebug(0L, "[RwsExchangeRunspaceConfiguration::GetNestedSecurityGroupMembership] OrgId == null"); return(base.GetNestedSecurityGroupMembership(user)); }
private static void FixTenantId(IConfigurable instance) { IPropertyBag propertyBag = instance as IPropertyBag; OrganizationId organizationId = (OrganizationId)propertyBag[ADObjectSchema.OrganizationId]; if (organizationId == null) { return; } IConfigDataProvider tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, true, ConsistencyMode.IgnoreInvalid, null, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(organizationId), 192, "FixTenantId", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\MessageHygiene\\HygieneConfiguration\\FfoDualWriter.cs"); Guid objectGuid; ADOperationResult externalDirectoryOrganizationId = SystemConfigurationTasksHelper.GetExternalDirectoryOrganizationId(tenantOrTopologyConfigurationSession, organizationId, out objectGuid); if (!externalDirectoryOrganizationId.Succeeded) { throw new InvalidOperationException("Error resolving orgId to external org id", externalDirectoryOrganizationId.Exception); } string distinguishedName = FfoDualWriter.FfoRootDN.GetChildId(organizationId.OrganizationalUnit.Name).GetChildId(objectGuid.ToString()).DistinguishedName; propertyBag[ADObjectSchema.OrganizationalUnitRoot] = new ADObjectId(distinguishedName, objectGuid); }
protected OrganizationId GetOrganizationId(OrganizationId currentOrgId, ADObjectId id) { if (OrganizationId.ForestWideOrgId.Equals(currentOrgId) && id != null) { if (id.Parent != null && TemplateTenantConfiguration.IsTemplateTenantName(id.Parent.Name) && TemplateTenantConfiguration.GetLocalTemplateTenant() != null) { return(TemplateTenantConfiguration.GetLocalTemplateTenant().OrganizationId); } IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(id), 350, "GetOrganizationId", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\ADIdParameter.cs"); ADRawEntry adrawEntry = tenantOrTopologyConfigurationSession.ReadADRawEntry(id, new ADPropertyDefinition[] { ADObjectSchema.OrganizationId }); if (adrawEntry != null) { return((OrganizationId)adrawEntry[ADObjectSchema.OrganizationId]); } IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(id), 365, "GetOrganizationId", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\ADIdParameter.cs"); adrawEntry = tenantOrRootOrgRecipientSession.ReadADRawEntry(id, new ADPropertyDefinition[] { ADObjectSchema.OrganizationId }); if (adrawEntry != null) { return((OrganizationId)adrawEntry[ADObjectSchema.OrganizationId]); } } return(currentOrgId); }
internal static Dictionary <Guid, AdTagData> GetTagsInPolicy(MailboxSession session, ADUser aduser, Dictionary <Guid, AdTagData> allAdTags) { if (allAdTags == null || allAdTags.Count == 0 || aduser == null) { return(null); } string arg = session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(); ADObjectId adobjectId = aduser.RetentionPolicy; if (adobjectId == null && aduser.ShouldUseDefaultRetentionPolicy && aduser.OrganizationId != null && !OrganizationId.ForestWideOrgId.Equals(aduser.OrganizationId)) { IConfigurationSession scopedSession; if (SharedConfiguration.IsDehydratedConfiguration(aduser.OrganizationId)) { scopedSession = SharedConfiguration.CreateScopedToSharedConfigADSession(aduser.OrganizationId); } else { scopedSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.FullyConsistent, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(aduser.OrganizationId), 149, "GetTagsInPolicy", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\ELC\\AdTagReader.cs"); } IList <RetentionPolicy> defaultRetentionPolicy = SharedConfiguration.GetDefaultRetentionPolicy(scopedSession, aduser, null, 1); if (defaultRetentionPolicy != null && defaultRetentionPolicy.Count > 0) { adobjectId = defaultRetentionPolicy[0].Id; } } if (adobjectId == null) { AdReader.Tracer.TraceDebug <string>(0L, "Mailbox '{0}' does not have an ELC Mailbox policy.", arg); return(null); } IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(false, ConsistencyMode.FullyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(adobjectId), 175, "GetTagsInPolicy", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\ELC\\AdTagReader.cs"); RetentionPolicy retentionPolicy = tenantOrTopologyConfigurationSession.Read <RetentionPolicy>(adobjectId); if (retentionPolicy == null) { AdReader.Tracer.TraceDebug <string, ADObjectId>(0L, "Mailbox '{0}' no matching ELC Mailbox policy for Template '{1}'.", arg, adobjectId); return(null); } MultiValuedProperty <ADObjectId> retentionPolicyTagLinks = retentionPolicy.RetentionPolicyTagLinks; Dictionary <Guid, AdTagData> dictionary = new Dictionary <Guid, AdTagData>(); List <AdTagData> list = new List <AdTagData>(); List <AdTagData> list2 = new List <AdTagData>(); int num = 0; Dictionary <Guid, AdTagData> dictionary2 = new Dictionary <Guid, AdTagData>(); foreach (Guid key in allAdTags.Keys) { AdTagData adTagData = allAdTags[key]; dictionary2[adTagData.Tag.Guid] = adTagData; } foreach (ADObjectId adobjectId2 in retentionPolicyTagLinks) { if (!dictionary2.ContainsKey(adobjectId2.ObjectGuid)) { AdReader.Tracer.TraceDebug <string, string>(0L, "Mailbox '{0}' has link '{1}' in policy to a tag that could not be found in the AD. Skipping user.", arg, adobjectId2.DistinguishedName); throw new IWTransientException(Strings.descTagNotInAD(adobjectId2.DistinguishedName)); } AdTagData adTagData2 = dictionary2[adobjectId2.ObjectGuid]; if (adTagData2.Tag.Type == ElcFolderType.All) { if (ElcMailboxHelper.IsArchiveTag(adTagData2, false)) { AdReader.Tracer.TraceDebug <string, string>(0L, "Mailbox '{0}'. Tag {1} is a default archive tag.", arg, adTagData2.Tag.Name); list2.Add(adTagData2); } else if (adTagData2.Tag.IsPrimary) { AdReader.Tracer.TraceDebug <string, string>(0L, "Mailbox '{0}'. Tag {1} is the primary default retention tag.", arg, adTagData2.Tag.Name); list.Insert(0, adTagData2); num++; } else { AdReader.Tracer.TraceDebug <string, string>(0L, "Mailbox '{0}'. Tag {1} is a default retention tag.", arg, adTagData2.Tag.Name); list.Add(adTagData2); } } else { dictionary[adobjectId2.ObjectGuid] = dictionary2[adobjectId2.ObjectGuid]; } } if (list2.Count > 0) { AdReader.Tracer.TraceDebug <string, string, int>(0L, "Mailbox '{0}' with policy '{1}' has {2} default MTA tags.", arg, retentionPolicy.Id.DistinguishedName, list2.Count); list2.Sort(delegate(AdTagData x, AdTagData y) { if (x.ContentSettings.Count != 1) { return(1); } if (y.ContentSettings.Count != 1) { return(-1); } return(x.ContentSettings.Single <KeyValuePair <Guid, ContentSetting> >().Value.MessageClass.Length - y.ContentSettings.Single <KeyValuePair <Guid, ContentSetting> >().Value.MessageClass.Length); }); AdTagData firstArchiveTag = new AdTagData(); firstArchiveTag.Tag = list2[0].Tag; firstArchiveTag.ContentSettings = new SortedDictionary <Guid, ContentSetting>(); list2.SelectMany((AdTagData x) => x.ContentSettings.Values).ForEach(delegate(ContentSetting x) { firstArchiveTag.ContentSettings[x.Guid] = x; }); dictionary[firstArchiveTag.Tag.Guid] = firstArchiveTag; } if (list.Count > 0) { if (num > 1) { AdReader.Tracer.TraceDebug <string, string>(0L, "Mailbox '{0}' has policy '{1}' with corrupted default tags (Primary default should be 1). Skipping user.", arg, retentionPolicy.Id.DistinguishedName); throw new IWPermanentException(Strings.descPrimaryDefaultCorrupted(retentionPolicy.Id.DistinguishedName, num)); } if (num == 0 && list.Count > 1) { list.Sort(delegate(AdTagData x, AdTagData y) { if (x.ContentSettings.Count != 1) { return(1); } if (y.ContentSettings.Count != 1) { return(-1); } return(x.ContentSettings.Single <KeyValuePair <Guid, ContentSetting> >().Value.MessageClass.Length - y.ContentSettings.Single <KeyValuePair <Guid, ContentSetting> >().Value.MessageClass.Length); }); } for (int i = 0; i < list.Count; i++) { Guid guid = list[i].Tag.Guid; dictionary[guid] = list[i]; } } return(dictionary); }
public MailboxAuditLogSearchWorker(int searchTimeoutSeconds, MailboxAuditLogSearch searchCriteria, Unlimited <int> resultSize, AuditLogOpticsLogData searchStatistics) { if (searchTimeoutSeconds <= 0) { throw new ArgumentOutOfRangeException("searchTimeoutSeconds"); } if (searchCriteria == null) { throw new ArgumentNullException("searchCriteria"); } this.searchCriteria = searchCriteria; this.searchStatistics = searchStatistics; if (MailboxAuditLogSearchWorker.UseFASTQuery(this.searchCriteria)) { this.queryString = this.GenerateFASTSearchQueryString(); } else { this.queryFilter = this.GenerateSearchQueryFilter(); } this.searchTimeoutSeconds = searchTimeoutSeconds; this.resultSize = resultSize; this.recipientSessionInternal = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(searchCriteria.OrganizationId), 163, ".ctor", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MailboxAuditLog\\MailboxAuditLogSearchWorker.cs"); }
protected override void InternalValidate() { base.InternalValidate(); if (base.HasErrors) { return; } if (this.Identity != null) { this.Server = ServerIdParameter.Parse(this.Identity.Server); } if (this.Server == null || string.Compare(this.Server.ToString(), "localhost", true) == 0) { this.Server = new ServerIdParameter(); } IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(base.CurrentOrganizationId), 263, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\Queueviewer\\QueueTasks.cs"); ServerIdParameter server = this.Server; Server entry = (Server)this.GetDataObject <Server>(server, tenantOrTopologyConfigurationSession, null, null, Strings.ErrorServerNotFound(server.ToString()), Strings.ErrorServerNotUnique(server.ToString())); ADScopeException ex; if (!tenantOrTopologyConfigurationSession.TryVerifyIsWithinScopes(entry, true, out ex)) { base.WriteError(new TaskInvalidOperationException(Strings.ErrorCannotChangeObjectOutOfWriteScope((this.Identity != null) ? this.Identity.ToString() : this.Server.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ExchangeErrorCategory.Context, this.Identity); } if (this.Filter != null && !VersionedQueueViewerClient.UsePropertyBagBasedAPI((string)this.Server)) { this.InitializeInnerFilter <QueueInfoSchema>(this.Filter, ObjectSchema.GetInstance <QueueInfoSchema>()); } }
private string GetOabObjectId(ADUser user) { if (user.OfflineAddressBook != null) { return(user.OfflineAddressBook.ObjectGuid.ToString()); } MailboxDatabase mailboxDatabase = base.ConfigSession.Read <MailboxDatabase>(user.Database); if (mailboxDatabase == null) { base.WriteError(new TestWebServicesTaskException(Strings.ErrorOabNotFoundForUser(user.Identity.ToString())), ErrorCategory.InvalidData, null); } else if (mailboxDatabase.OfflineAddressBook != null) { return(mailboxDatabase.OfflineAddressBook.ObjectGuid.ToString()); } IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(user.Id), 258, "GetOabObjectId", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\AutoDiscover\\TestOutlookWebServicesTask.cs"); OfflineAddressBook[] array = tenantOrTopologyConfigurationSession.Find <OfflineAddressBook>(null, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, OfflineAddressBookSchema.IsDefault, true), null, 1); if (array.Length > 0) { return(array[0].Id.ObjectGuid.ToString()); } base.WriteError(new TestWebServicesTaskException(Strings.ErrorOabNotFoundForUser(user.Identity.ToString())), ErrorCategory.InvalidData, null); return(null); }
// Token: 0x06000ABF RID: 2751 RVA: 0x00046714 File Offset: 0x00044914 private bool TryReadUserConfiguration(MailboxInfo mailbox, out ADUser user, out UMDialPlan dialPlan, out bool sendSms, out bool sendMsgWaitingIndicator) { user = null; dialPlan = null; sendSms = false; sendMsgWaitingIndicator = false; IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(mailbox.OrganizationId, null); user = (iadrecipientLookup.LookupByExchangeGuid(mailbox.Guid) as ADUser); if (user == null) { ExTraceGlobals.MWITracer.TraceError <Guid>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find ADUser for mailbox {0}", mailbox.Guid); return(false); } if (!user.UMEnabled || user.UMMailboxPolicy == null || user.UMRecipientDialPlanId == null) { ExTraceGlobals.MWITracer.TraceError((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: ({0}): Invalid user({1}) UMEnabled({2}) UMMbxPol({3}) DialPlan({4})", new object[] { mailbox.Guid, user.DistinguishedName, user.UMEnabled, user.UMMailboxPolicy, user.UMRecipientDialPlanId }); return(false); } IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(user.UMMailboxPolicy), 1108, "TryReadUserConfiguration", "f:\\15.00.1497\\sources\\dev\\MailboxAssistants\\src\\assistants\\mwi\\MwiAssistant.cs"); UMMailboxPolicy ummailboxPolicy = tenantOrTopologyConfigurationSession.Read <UMMailboxPolicy>(user.UMMailboxPolicy); if (ummailboxPolicy == null) { ExTraceGlobals.MWITracer.TraceError <ADObjectId, string>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find UMMailboxPolicy: {0}, User {1}", user.UMMailboxPolicy, user.DistinguishedName); return(false); } sendSms = ummailboxPolicy.AllowSMSNotification; sendMsgWaitingIndicator = ummailboxPolicy.AllowMessageWaitingIndicator; ExTraceGlobals.MWITracer.TraceDebug <bool, bool, string>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: AllowSMSNotification={0}, AllowMessageWaitingIndicator={1}, User {2}", sendSms, sendMsgWaitingIndicator, user.DistinguishedName); bool flag = sendSms || sendMsgWaitingIndicator; if (flag) { dialPlan = tenantOrTopologyConfigurationSession.Read <UMDialPlan>(user.UMRecipientDialPlanId); if (dialPlan == null) { ExTraceGlobals.MWITracer.TraceError <ADObjectId>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration: Could not find UMDialPlan: {0}", user.UMRecipientDialPlanId); return(false); } ExTraceGlobals.MWITracer.TraceDebug <string, ADObjectId, UMSubscriberType>((long)this.GetHashCode(), "MwiAssistant.TryReadUserConfiguration User {0} DialPlan{1}.SubscriberType={2}.", user.DistinguishedName, dialPlan.Id, dialPlan.SubscriberType); } return(flag); }
internal static ICredentials GetCredentialAndConfigureClientContext(ADRawEntry actAsUser, OrganizationId actAsUserOrgId, ClientContext context, bool createAppTokenOnly, out bool isOAuthCredential) { if (!createAppTokenOnly && actAsUser == null) { throw new ArgumentNullException("actAsUser"); } if (actAsUserOrgId == null) { throw new ArgumentNullException("actAsUserOrgId"); } int num = 0; isOAuthCredential = true; RegistryKey registryKey = null; try { registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\MSExchangeRPC\\ParametersSystem", RegistryKeyPermissionCheck.ReadSubTree); if (registryKey != null) { num = (int)registryKey.GetValue("TMPublishHttpDebugEnabled", 0); if ((int)registryKey.GetValue("TMOAuthEnabled", 1) == 0) { isOAuthCredential = false; return(null); } } } catch (SecurityException) { return(null); } catch (IOException) { return(null); } catch (UnauthorizedAccessException) { return(null); } finally { if (registryKey != null) { registryKey.Close(); } } ICredentials credentials; if (createAppTokenOnly) { credentials = OAuthCredentials.GetOAuthCredentialsForAppToken(actAsUserOrgId, "PlaceHolder"); } else { ADObjectId id = actAsUser.Id; ADSessionSettings sessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(id); IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 552, "GetCredentialAndConfigureClientContext", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\TeamMailbox\\TeamMailboxHelper.cs"); ADUser aduser = tenantOrRootOrgRecipientSession.FindADUserByObjectId(id); credentials = OAuthCredentials.GetOAuthCredentialsForAppActAsToken(actAsUserOrgId, aduser, null); } if (context != null) { context.Credentials = credentials; context.FormDigestHandlingEnabled = false; context.ExecutingWebRequest += delegate(object sender, WebRequestEventArgs args) { args.WebRequestExecutor.RequestHeaders.Add(HttpRequestHeader.Authorization, "Bearer"); args.WebRequestExecutor.RequestHeaders.Add("client-request-id", Guid.NewGuid().ToString()); args.WebRequestExecutor.RequestHeaders.Add("return-client-request-id", "true"); args.WebRequestExecutor.WebRequest.PreAuthenticate = true; args.WebRequestExecutor.WebRequest.UserAgent = Utils.GetUserAgentStringForSiteMailboxRequests(); }; if (num == 1) { context.ExecutingWebRequest += delegate(object sender, WebRequestEventArgs args) { args.WebRequestExecutor.WebRequest.Proxy = new WebProxy("127.0.0.1", 8888); }; } } return(credentials); }
// Token: 0x06001426 RID: 5158 RVA: 0x0004910C File Offset: 0x0004730C protected override ADRawEntry LoadExecutingUser(IIdentity identity, IList <PropertyDefinition> properties) { this.LinkedAccountUser = ((PartnerApplicationRunspaceConfiguration.LinkedAccountIdentity)identity).LinkedAccountUser; this.recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(this.LinkedAccountUser.Id), 224, "LoadExecutingUser", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\rbac\\PartnerApplicationRunspaceConfiguration.cs"); return(this.LinkedAccountUser); }
protected override void InternalValidate() { Dictionary <Guid, bool> dictionary = new Dictionary <Guid, bool>(); TaskLogger.LogEnter(); base.InternalValidate(); if (!base.HasErrors) { this.rootOrgConfigSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 123, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs"); if (this.DialPlan != null) { IEnumerable <UMDialPlan> objects = this.DialPlan.GetObjects <UMDialPlan>(null, this.rootOrgConfigSession); using (IEnumerator <UMDialPlan> enumerator = objects.GetEnumerator()) { if (!enumerator.MoveNext()) { base.WriteError(new LocalizedException(Strings.NonExistantDialPlan(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan); } this.adResults = enumerator.Current; if (enumerator.MoveNext()) { base.WriteError(new LocalizedException(Strings.MultipleDialplansWithSameId(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan); } } UMDialPlan dialPlan = (UMDialPlan)this.adResults; if (Utility.DialPlanHasIncompatibleServers(dialPlan, this.rootOrgConfigSession, dictionary)) { this.WriteWarning(Strings.InvalidServerVersionInDialPlan(((UMDialPlan)this.adResults).Name)); } } else { if (this.IPGateway != null) { IEnumerable <UMIPGateway> objects2 = this.IPGateway.GetObjects <UMIPGateway>(null, this.rootOrgConfigSession); using (IEnumerator <UMIPGateway> enumerator2 = objects2.GetEnumerator()) { if (!enumerator2.MoveNext()) { base.WriteError(new LocalizedException(Strings.NonExistantIPGateway(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway); } this.adResults = enumerator2.Current; if (enumerator2.MoveNext()) { base.WriteError(new LocalizedException(Strings.MultipleIPGatewaysWithSameId(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway); } } if (CommonConstants.UseDataCenterCallRouting) { goto IL_36F; } UMIPGateway umipgateway = (UMIPGateway)this.adResults; using (MultiValuedProperty <UMHuntGroup> .Enumerator enumerator3 = umipgateway.HuntGroups.GetEnumerator()) { while (enumerator3.MoveNext()) { UMHuntGroup umhuntGroup = enumerator3.Current; if (umhuntGroup.UMDialPlan != null && !dictionary.ContainsKey(umhuntGroup.UMDialPlan.ObjectGuid)) { dictionary[umhuntGroup.UMDialPlan.ObjectGuid] = true; IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(umhuntGroup.UMDialPlan), 189, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs"); UMDialPlan dialPlan2 = tenantOrTopologyConfigurationSession.Read <UMDialPlan>(umhuntGroup.UMDialPlan); if (Utility.DialPlanHasIncompatibleServers(dialPlan2, this.rootOrgConfigSession, dictionary)) { this.WriteWarning(Strings.InvalidServerVersionInGateway(umipgateway.Name)); } } } goto IL_36F; } } if (this.Server != null) { IEnumerable <Server> objects3 = this.Server.GetObjects <Server>(null, this.rootOrgConfigSession); using (IEnumerator <Server> enumerator4 = objects3.GetEnumerator()) { if (!enumerator4.MoveNext()) { base.WriteError(new LocalizedException(Strings.NonExistantServer(this.Server.ToString())), ErrorCategory.InvalidData, this.Server); } this.adResults = enumerator4.Current; if (enumerator4.MoveNext()) { base.WriteError(new LocalizedException(Strings.MultipleServersWithSameId(this.Server.ToString())), ErrorCategory.InvalidData, this.Server); } } Server target = (Server)this.adResults; this.ValidateServerIsCompatible(target); } else if (this.InstanceServer != null) { Server target2 = (Server)this.InstanceServer.DataObject; this.ValidateServerIsCompatible(target2); } } } IL_36F: TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { bool flag = base.DataSession.Read <TransportConfigContainer>(this.DataObject.Id) == null; MessageDeliveryGlobalSettings[] array = null; IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(base.CurrentOrganizationId), 48, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\InstallTransportSettingsContainerTask.cs"); if (flag) { base.InternalProcessRecord(); array = tenantOrTopologyConfigurationSession.Find <MessageDeliveryGlobalSettings>(base.CurrentOrgContainerId, QueryScope.SubTree, new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, MessageDeliveryGlobalSettings.DefaultName), null, 1); } if (base.Organization == null) { if (flag) { if (array != null && array.Length == 1) { this.ApplyTiGlobalSettingsToE12(array[0], tenantOrTopologyConfigurationSession); return; } this.ApplyDefaultTransportSettings(tenantOrTopologyConfigurationSession); return; } else { this.ApplyE12SettingsToTiGlobalSettings(tenantOrTopologyConfigurationSession); } } }
internal IConfigurationSession GetWritableSession(ADObjectId identity) { this.writableConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(identity), 106, "GetWritableSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\permission\\SetADPermissionTaskBase.cs"); if (identity.IsDescendantOf(this.writableConfigurationSession.ConfigurationNamingContext)) { return(this.writableConfigurationSession); } if (base.DomainControllerDomainId == null || base.DomainControllerDomainId.Equals(identity.DomainId)) { return(this.writableSessionOnSpcecifiedDC); } return(this.writableSession); }
internal static IConfigurationSession GetRootOrgOrAllTenantsConfigurationSession(ADObjectId objectId) { return(DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(objectId), 477, "GetRootOrgOrAllTenantsConfigurationSession", "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\Misc\\DirectoryHelper.cs")); }
private static IRecipientSession GetRecipientSession(OrganizationId organizationId) { return(DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(organizationId), 302, "GetRecipientSession", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\rbac\\PowerShellThrottlingPolicyUpdater.cs")); }
private OrganizationId ResolveOrganization(ADObjectId entryId) { OrganizationId organizationId; try { if (entryId == null) { throw new ArgumentNullException("entryId"); } IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(entryId), 1191, "ResolveOrganization", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\MailboxSearch\\Common\\MailboxSearchConfigurationProvider.cs"); ADRecipient adrecipient = tenantOrRootOrgRecipientSession.Read(entryId); if (adrecipient == null) { throw new ObjectNotFoundException(ServerStrings.ADUserNotFoundId(entryId)); } organizationId = adrecipient.OrganizationId; } catch (InvalidOperationException arg) { Util.Tracer.TraceError <InvalidOperationException>((long)this.GetHashCode(), "ResolveUserOrganization error: {0}", arg); throw; } catch (DataSourceOperationException arg2) { Util.Tracer.TraceError <DataSourceOperationException>((long)this.GetHashCode(), "ResolveUserOrganization error: {0}", arg2); throw; } catch (TransientException arg3) { Util.Tracer.TraceError <TransientException>((long)this.GetHashCode(), "ResolveUserOrganization error: {0}", arg3); throw; } catch (DataValidationException arg4) { Util.Tracer.TraceError <DataValidationException>((long)this.GetHashCode(), "ResolveUserOrganization error: {0}", arg4); throw; } return(organizationId); }