protected override void InternalProcessRecord() { TaskLogger.LogEnter(); InstallCannedRbacRoles.isFfoEnvironment = (base.Fields.Contains("IsFfo") && this.IsFfo); this.configurationSession.SessionSettings.IsSharedConfigChecked = true; base.InternalProcessRecord(); RoleDefinition[] roleDefinitions; RoleNameMappingCollection mapping; string[] rolesToRemove; InstallCannedRbacRoles.CalculateRoleConfigurationForCurrentSKU(this.Organization, base.ServicePlanSettings, out roleDefinitions, out mapping, out rolesToRemove, out this.allAllowedRoleEntriesForSKU); this.RemoveRolesAndAssignments(rolesToRemove); this.UpdateRolesInOrg(mapping, roleDefinitions, base.ServicePlanSettings); TaskLogger.LogExit(); }
internal static void CalculateRoleConfigurationForCurrentSKU(OrganizationIdParameter organization, out RoleDefinition[] roles, out RoleNameMappingCollection nameMapping, out string[] rolesToRemove, out RoleEntry[] allAllowedRoleEntriesForSKU) { InstallCannedRbacRoles.CalculateRoleConfigurationForCurrentSKU(organization, null, out roles, out nameMapping, out rolesToRemove, out allAllowedRoleEntriesForSKU); }
protected override void InternalProcessRecord() { base.InternalProcessRecord(); RoleDefinition[] array; RoleNameMappingCollection roleNameMappingCollection; string[] array2; InstallCannedRbacRoles.CalculateRoleConfigurationForCurrentSKU(this.Organization, out array, out roleNameMappingCollection, out array2, out this.allAllowedRoleEntriesForSKU); List <ExchangeRole> list = new List <ExchangeRole>(); List <ExchangeRole> list2 = new List <ExchangeRole>(); bool flag = false; if (this.Organization != null) { ExchangeConfigurationUnit exchangeConfigUnitFromOrganizationId = OrganizationTaskHelper.GetExchangeConfigUnitFromOrganizationId(this.Organization, this.configurationSession, new Task.TaskErrorLoggingDelegate(base.WriteError), true); flag = !ServicePlanConfiguration.GetInstance().GetServicePlanSettings(exchangeConfigUnitFromOrganizationId.ProgramId, exchangeConfigUnitFromOrganizationId.OfferId).Organization.PerMBXPlanRoleAssignmentPolicyEnabled; } ADPagedReader <ExchangeRole> adpagedReader = this.configurationSession.FindAllPaged <ExchangeRole>(); foreach (ExchangeRole exchangeRole in adpagedReader) { base.LogReadObject(exchangeRole); if (!exchangeRole.IsDeprecated) { if (exchangeRole.HasDownlevelData) { exchangeRole[ExchangeRoleSchema.InternalDownlevelRoleEntries] = null; } this.RemoveObsoleteEntriesAndParameters(exchangeRole); if (exchangeRole.RoleEntries.Count == 0) { base.WriteVerbose(Strings.VerboseDeprecatingRoleBecauseNoEntriesLeft(exchangeRole.Id.ToString())); exchangeRole.RoleState = RoleState.Deprecated; } this.configurationSession.Save(exchangeRole); base.LogWriteObject(exchangeRole); } if (flag && exchangeRole.IsEndUserRole) { exchangeRole.MailboxPlanIndex = string.Empty; this.configurationSession.Save(exchangeRole); base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(exchangeRole, this.configurationSession, typeof(ExchangeRole))); base.LogWriteObject(exchangeRole); } if (exchangeRole.IsDeprecated) { this.DeleteRoleAssigments(exchangeRole); if (exchangeRole.IsRootRole) { list.Add(exchangeRole); } else { list2.Add(exchangeRole); } } } foreach (ExchangeRole exchangeRole2 in list) { this.configurationSession.DeleteTree(exchangeRole2, delegate(ADTreeDeleteNotFinishedException de) { if (de != null) { base.WriteVerbose(de.LocalizedString); } }); base.WriteVerbose(Strings.ProgressActivityRemovingManagementRoleTree(exchangeRole2.Id.ToString())); } foreach (ExchangeRole exchangeRole3 in list2) { ExchangeRole exchangeRole4 = this.configurationSession.Read <ExchangeRole>(exchangeRole3.Id); if (exchangeRole4 != null) { base.LogReadObject(exchangeRole4); this.configurationSession.DeleteTree(exchangeRole4, delegate(ADTreeDeleteNotFinishedException de) { if (de != null) { base.WriteVerbose(de.LocalizedString); } }); base.WriteVerbose(Strings.ConfirmationMessageRemoveManagementRole(exchangeRole4.Id.ToString())); } } }