private bool UpdateImplictScope(ExchangeRole exchangeRole) { string value = exchangeRole.Name.Replace(" ", string.Empty).Replace("-", string.Empty); RoleType roleType; if (Enum.TryParse <RoleType>(value, true, out roleType)) { exchangeRole.RoleType = roleType; exchangeRole.StampImplicitScopes(); exchangeRole.StampIsEndUserRole(); return(true); } return(false); }
public ExchangeRole GenerateRole(List <string> enabledFeatures, ADObjectId rolesContainerId, string suffix, string resolutionType) { ExchangeRole exchangeRole = new ExchangeRole(); string input = null; exchangeRole.SetId(rolesContainerId.GetChildId(this.RoleName + suffix)); exchangeRole.RoleType = this.roleType; exchangeRole.MailboxPlanIndex = resolutionType; exchangeRole.StampImplicitScopes(); exchangeRole.StampIsEndUserRole(); foreach (RoleCmdlet roleCmdlet in this.cmdlets) { if (roleCmdlet.TryGenerateRoleEntry(enabledFeatures, ref input)) { exchangeRole.RoleEntries.Add(RoleEntry.Parse(input)); } } return(exchangeRole); }
protected RoleEntry[] PrepareRoleForUpgradeAndGetOldSortedEntries(ExchangeRole roleToUpgrade, bool isDeprecated) { ExTraceGlobals.AccessCheckTracer.TraceFunction <string>(20005L, "-->PrepareRoleForUpgradeAndGetOldSortedEntries: roleToUpgrade = {0}", roleToUpgrade.Name); RoleEntry[] sortedRoleEntries = this.GetSortedRoleEntries(roleToUpgrade); roleToUpgrade[ExchangeRoleSchema.RoleFlags] = 0; roleToUpgrade.StampImplicitScopes(); roleToUpgrade.StampIsEndUserRole(); if (isDeprecated) { roleToUpgrade.RoleState = RoleState.Deprecated; } if (roleToUpgrade.ExchangeVersion.IsOlderThan(ExchangeRoleSchema.CurrentRoleVersion) && roleToUpgrade.RoleState != RoleState.Deprecated) { roleToUpgrade.SetExchangeVersion(ExchangeRoleSchema.CurrentRoleVersion); ExTraceGlobals.AccessCheckTracer.TraceFunction <string>(20005L, "----PrepareRoleForUpgradeAndGetOldSortedEntries: Version bumped to '{0}'.", roleToUpgrade.ExchangeVersion.ToString()); } if (roleToUpgrade.ExchangeVersion == ExchangeRoleSchema.Exchange2009_R3) { roleToUpgrade.RoleEntries = null; } ExTraceGlobals.AccessCheckTracer.TraceFunction(20005L, "<--PrepareRoleForUpgradeAndGetOldSortedEntries"); return(sortedRoleEntries); }