// Token: 0x06000DCE RID: 3534 RVA: 0x00029590 File Offset: 0x00027790 private IEnumerable <T> TryGetObjectsFromDC <T>(ADObjectId rootId, IDirectorySession subTreeSession, OptionalIdentityData optionalData) where T : IConfigurable, new() { if (rootId != null || this.HasEmptyGuid || Datacenter.GetExchangeSku() != Datacenter.ExchangeSku.Enterprise) { return(EnumerableWrapper <T> .Empty); } rootId = subTreeSession.GetRootDomainNamingContext(); if (rootId != null && optionalData != null && optionalData.RootOrgDomainContainerId != null) { optionalData.RootOrgDomainContainerId = null; } bool useGlobalCatalog = subTreeSession.UseGlobalCatalog; IEnumerable <T> exactMatchObjects; try { subTreeSession.UseGlobalCatalog = false; exactMatchObjects = base.GetExactMatchObjects <T>(rootId, subTreeSession, optionalData); } finally { subTreeSession.UseGlobalCatalog = useGlobalCatalog; } return(exactMatchObjects); }
private IRecipientSession GetRecipientSessionForMonitoringMailbox() { if (Datacenter.GetExchangeSku() == Datacenter.ExchangeSku.ExchangeDatacenter) { if (this.monitoringTenantRecipientSession == null) { ADSessionSettings sessionSettings = ADSessionSettings.FromTenantCUName(MailboxTaskHelper.GetMonitoringTenantName("E15")); this.monitoringTenantRecipientSession = DirectorySessionFactory.Default.CreateTenantRecipientSession(true, ConsistencyMode.IgnoreInvalid, sessionSettings, 540, "GetRecipientSessionForMonitoringMailbox", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\ContentIndex\\TestSearch.cs"); } return(this.monitoringTenantRecipientSession); } return(base.RootOrgGlobalCatalogSession); }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); ADGroup adgroup = (ADGroup)base.PrepareDataObject(); if (!this.BypassSecurityGroupManagerCheck) { ADObjectId user; base.TryGetExecutingUserId(out user); RoleGroupCommon.ValidateExecutingUserHasGroupManagementRights(user, adgroup, base.ExchangeRunspaceConfig, new Task.ErrorLoggerDelegate(base.WriteError)); } if ("crossforest" == base.ParameterSetName && adgroup.RoleGroupType == RoleGroupType.Standard) { base.WriteError(new RecipientTaskException(Strings.ErrorCannotChangeRoleGroupType), (ErrorCategory)1000, null); } if ("ExchangeDatacenterCrossForestParameterSet" == base.ParameterSetName) { if (Datacenter.ExchangeSku.ExchangeDatacenter != Datacenter.GetExchangeSku() && Datacenter.ExchangeSku.DatacenterDedicated != Datacenter.GetExchangeSku()) { base.WriteError(new InvalidOperationException(Strings.ErrorLinkedSidParameterNotAllowed(RoleGroupParameters.ParameterLinkedForeignGroupSid)), (ErrorCategory)1000, null); } this.linkedGroupSid = this.LinkedForeignGroupSid; } if ("crossforest" == base.ParameterSetName || "ExchangeDatacenterCrossForestParameterSet" == base.ParameterSetName) { adgroup.ForeignGroupSid = this.linkedGroupSid; if (adgroup.Members.Count > 0) { base.WriteError(new RecipientTaskException(Strings.ErrorLinkedRoleGroupCannotHaveMembers), (ErrorCategory)1000, null); } } if (base.Fields.IsModified("DisplayName")) { adgroup[RoleGroupSchema.DisplayName] = this.DisplayName; } this.roleGroup = RoleGroupCommon.PopulateRoleAssignmentsAndConvert(adgroup, this.ConfigurationSession); if (base.Fields.IsModified("Description")) { adgroup[ADGroupSchema.RoleGroupDescription] = (string.IsNullOrEmpty(this.Description) ? null : this.Description); } if (this.ExternalDirectoryObjectId != Guid.Empty) { adgroup.ExternalDirectoryObjectId = this.ExternalDirectoryObjectId.ToString(); } TaskLogger.LogExit(); return(adgroup); }
internal static RoleGroupCollection RoleGroupsToCreate() { RoleGroupCollection roleGroupCollection = new RoleGroupCollection(); Datacenter.ExchangeSku exchangeSku = Datacenter.GetExchangeSku(); RoleGroupRoleMapping[] definition; if (Datacenter.IsMicrosoftHostedOnly(false)) { definition = Datacenter_RoleGroupDefinition.Definition; } else if (Datacenter.IsPartnerHostedOnly(false)) { definition = Hosting_RoleGroupDefinition.Definition; } else if (Datacenter.IsDatacenterDedicated(false)) { definition = Dedicated_RoleGroupDefinition.Definition; } else { definition = Enterprise_RoleGroupDefinition.Definition; } using (List <RoleGroupDefinition> .Enumerator enumerator = RoleGroupDefinitions.RoleGroups.GetEnumerator()) { while (enumerator.MoveNext()) { RoleGroupDefinition roleGroup = enumerator.Current; if (roleGroup.AlwaysCreateOnSku != null && roleGroup.AlwaysCreateOnSku.Contains(exchangeSku)) { roleGroupCollection.Add(new RoleGroupDefinition(roleGroup)); } else { RoleGroupRoleMapping roleGroupRoleMapping = definition.FirstOrDefault((RoleGroupRoleMapping x) => x.RoleGroup.Equals(roleGroup.Name, StringComparison.OrdinalIgnoreCase)); if (roleGroupRoleMapping != null) { roleGroupCollection.Add(new RoleGroupDefinition(roleGroup)); } } } } return(roleGroupCollection); }
protected override void InternalProcessRecord() { if (!this.isContainerExisted) { base.InternalProcessRecord(); } QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, EmailAddressPolicy.DefaultName); IConfigurationSession configurationSession = (IConfigurationSession)base.DataSession; ADObjectId currentOrgContainerId = base.CurrentOrgContainerId; EmailAddressPolicy[] array = configurationSession.Find <EmailAddressPolicy>(currentOrgContainerId, QueryScope.SubTree, filter, null, 0); if (array == null || array.Length == 0) { EmailAddressPolicy emailAddressPolicy = new EmailAddressPolicy(); emailAddressPolicy.SetId(this.DataObject.Id.GetChildId(EmailAddressPolicy.DefaultName)); emailAddressPolicy[EmailAddressPolicySchema.Enabled] = true; emailAddressPolicy.Priority = EmailAddressPolicyPriority.Lowest; if (Datacenter.GetExchangeSku() == Datacenter.ExchangeSku.Enterprise) { emailAddressPolicy.RecipientFilterApplied = true; } emailAddressPolicy.IncludedRecipients = new WellKnownRecipientType?(WellKnownRecipientType.AllRecipients); if (this.DomainName == null) { emailAddressPolicy.EnabledPrimarySMTPAddressTemplate = "@" + DNConvertor.FqdnFromDomainDistinguishedName(currentOrgContainerId.DomainId.DistinguishedName); } else { emailAddressPolicy.EnabledPrimarySMTPAddressTemplate = "@" + this.DomainName.ToString(); } RecipientFilterHelper.StampE2003FilterMetadata(emailAddressPolicy, emailAddressPolicy.LdapRecipientFilter, EmailAddressPolicySchema.PurportedSearchUI); if (base.CurrentOrganizationId != null) { emailAddressPolicy.OrganizationId = base.CurrentOrganizationId; } else { emailAddressPolicy.OrganizationId = base.ExecutingUserOrganizationId; } configurationSession.Save(emailAddressPolicy); } }
private static Datacenter.ExchangeSku GetExchangeSku() { Datacenter.ExchangeSku result; try { if (Datacenter.IsForefrontForOfficeDatacenter()) { result = Datacenter.ExchangeSku.ForefrontForOfficeDatacenter; } else { result = Datacenter.GetExchangeSku(); } } catch (CannotDetermineExchangeModeException innerException) { throw new ExchangeConfigurationException(MExRuntimeStrings.FailedToReadDataCenterMode, innerException); } return(result); }
public void CreatePublicFolderTree() { this.pfTree = new PublicFolderTree(); try { QueryFilter filter; ADObjectId adobjectId; if (Datacenter.GetExchangeSku() != Datacenter.ExchangeSku.ExchangeDatacenter) { filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, PublicFolderTreeContainer.DefaultName); PublicFolderTreeContainer[] array = this.taskInstance.GlobalConfigSession.Find <PublicFolderTreeContainer>(null, QueryScope.SubTree, filter, null, 1); PublicFolderTreeContainer publicFolderTreeContainer; if (array == null || array.Length == 0) { filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, AdministrativeGroup.DefaultName); AdministrativeGroup[] array2 = this.taskInstance.GlobalConfigSession.Find <AdministrativeGroup>(null, QueryScope.SubTree, filter, null, 1); if (array2 == null || array2.Length < 1) { throw new AdminGroupNotFoundException(AdministrativeGroup.DefaultName); } publicFolderTreeContainer = new PublicFolderTreeContainer(); publicFolderTreeContainer.SetId(array2[0].Id.GetChildId(PublicFolderTreeContainer.DefaultName)); this.taskInstance.DataSession.Save(publicFolderTreeContainer); } else { publicFolderTreeContainer = array[0]; } adobjectId = publicFolderTreeContainer.Id; } else { adobjectId = this.OrganizationId.ConfigurationUnit; this.pfTree.OrganizationId = this.OrganizationId; } this.pfTree.SetId(adobjectId.GetChildId("Public Folders")); this.taskInstance.WriteVerbose(Strings.VerboseCreatePublicFolderTree(this.pfTree.Id.ToString())); this.pfTree.PublicFolderTreeType = PublicFolderTreeType.Mapi; filter = new ComparisonFilter(ComparisonOperator.Equal, ExtendedRightSchema.DisplayName, "Create public folder"); this.taskInstance.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(this.taskInstance.GlobalConfigSession, typeof(ExtendedRight), filter, this.taskInstance.GlobalConfigSession.ConfigurationNamingContext, true)); ExtendedRight[] array3 = this.taskInstance.GlobalConfigSession.Find <ExtendedRight>(this.taskInstance.GlobalConfigSession.ConfigurationNamingContext, QueryScope.SubTree, filter, null, 1); if (0 < array3.Length) { ObjectAce objectAce = new ObjectAce(AceFlags.None, AceQualifier.AccessAllowed, 256, new SecurityIdentifier("AU"), ObjectAceFlags.ObjectAceTypePresent, array3[0].RightsGuid, Guid.Empty, false, null); DiscretionaryAcl discretionaryAcl = new DiscretionaryAcl(false, true, 11); discretionaryAcl.AddAccess(AccessControlType.Allow, objectAce.SecurityIdentifier, objectAce.AccessMask, objectAce.InheritanceFlags, objectAce.PropagationFlags, objectAce.ObjectAceFlags, objectAce.ObjectAceType, objectAce.InheritedObjectAceType); using (WindowsIdentity current = WindowsIdentity.GetCurrent()) { SecurityIdentifier user = current.User; CommonSecurityDescriptor commonSecurityDescriptor = new CommonSecurityDescriptor(false, true, ControlFlags.DiscretionaryAclPresent, user, user, null, discretionaryAcl); byte[] binaryForm = new byte[commonSecurityDescriptor.BinaryLength]; commonSecurityDescriptor.GetBinaryForm(binaryForm, 0); this.pfTree.SetPublicFolderDefaultAdminAcl(new RawSecurityDescriptor(binaryForm, 0)); } } this.taskInstance.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(this.TenantSession)); this.taskInstance.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(this.pfTree, this.TenantSession, typeof(PublicFolderTree))); this.TenantSession.Save(this.pfTree); if (Datacenter.GetExchangeSku() == Datacenter.ExchangeSku.ExchangeDatacenter) { this.SetOrganizationManagementACLs(this.pfTree); } } finally { this.taskInstance.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(this.TenantSession)); } }
public override bool?TryIsInRole(ExchangeRunspaceConfiguration rbacConfiguration) { return(new bool?(this.ExchangeSku == Datacenter.GetExchangeSku())); }