Esempio n. 1
0
        public static RoleUpgrader GetRoleUpgrader(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping, RoleDefinition roleDefinition)
        {
            RoleUpgrader result = null;

            foreach (RoleUpgraderFactory.CanUpgradeRoleDelegate canUpgradeRoleDelegate in RoleUpgraderFactory.knownUpgrades)
            {
                if (canUpgradeRoleDelegate(settings, roleNameMapping, roleDefinition, out result))
                {
                    break;
                }
            }
            return(result);
        }
        public new static bool CanUpgrade(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping, RoleDefinition roleDefinition, out RoleUpgrader roleUpgrader)
        {
            ExTraceGlobals.AccessCheckTracer.TraceFunction <string>(20009L, "-->MailboxPlanDeprecatedRoleUpgrader.CanUpgrade: roleName = {0}", roleDefinition.RoleName);
            bool flag = false;

            roleUpgrader = null;
            if (settings.Organization != null && roleDefinition.IsEndUserRole && roleNameMapping != null && roleNameMapping.IsDeprecatedRole && settings.ServicePlanSettings.Organization.PerMBXPlanRoleAssignmentPolicyEnabled)
            {
                flag = true;
            }
            if (flag)
            {
                roleUpgrader = new MailboxPlanDeprecatedRoleUpgrader(settings, roleNameMapping);
            }
            ExTraceGlobals.AccessCheckTracer.TraceFunction <bool>(20008L, "<--MailboxPlanDeprecatedRoleUpgrader.CanUpgrade: canUpgrade = {0}", flag);
            return(flag);
        }
        public new static bool CanUpgrade(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping, RoleDefinition roleDefinition, out RoleUpgrader roleUpgrader)
        {
            ExTraceGlobals.AccessCheckTracer.TraceFunction <string>(20009L, "-->SplitRoleUpgrader.CanUpgrade: roleName = {0}", roleDefinition.RoleName);
            bool flag = false;

            roleUpgrader = null;
            if (!roleDefinition.IsEndUserRole)
            {
                flag = true;
            }
            flag = (flag && roleNameMapping != null && roleNameMapping.IsSplitting);
            if (flag)
            {
                roleUpgrader = new SplitRoleUpgrader(settings, roleNameMapping);
            }
            ExTraceGlobals.AccessCheckTracer.TraceFunction <bool>(20009L, "<--SplitRoleUpgrader.CanUpgrade: canUpgrade = {0}", flag);
            return(flag);
        }
Esempio n. 4
0
        public static bool CanUpgrade(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping, RoleDefinition roleDefinition, out RoleUpgrader roleUpgrader)
        {
            ExTraceGlobals.AccessCheckTracer.TraceFunction <string>(20006L, "-->NonDeprecatedRoleUpgrader.CanUpgrade: roleName = {0}", roleDefinition.RoleName);
            bool flag = false;

            roleUpgrader = null;
            if (settings.Organization == null)
            {
                flag = true;
            }
            else if (!roleDefinition.IsEndUserRole || !settings.ServicePlanSettings.Organization.PerMBXPlanRoleAssignmentPolicyEnabled)
            {
                flag = true;
            }
            flag = (flag && (roleNameMapping == null || (!roleNameMapping.IsDeprecatedRole && !roleNameMapping.IsSplitting)));
            if (flag)
            {
                roleUpgrader = new NonDeprecatedRoleUpgrader(settings, roleNameMapping);
            }
            ExTraceGlobals.AccessCheckTracer.TraceFunction <bool>(20006L, "<--NonDeprecatedRoleUpgrader.CanUpgrade: canUpgrade = {0}", flag);
            return(flag);
        }
Esempio n. 5
0
 protected RoleUpgrader(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping)
 {
     this.settings        = settings;
     this.roleNameMapping = roleNameMapping;
 }
Esempio n. 6
0
        private void UpdateRolesInOrg(RoleNameMappingCollection mapping, RoleDefinition[] roleDefinitions, ServicePlan servicePlan)
        {
            TaskLogger.LogEnter();
            Container container = this.configurationSession.Read <Container>(this.rolesContainerId);

            if (container == null)
            {
                base.WriteError(new ContainerNotFoundException(this.rolesContainerId.DistinguishedName), ErrorCategory.ObjectNotFound, null);
            }
            base.LogReadObject(container);
            List <RoleDefinition>            list     = new List <RoleDefinition>();
            RoleUpgradeConfigurationSettings settings = new RoleUpgradeConfigurationSettings
            {
                AvailableRoleEntries     = this.allAllowedRoleEntriesForSKU,
                ConfigurationSession     = this.configurationSession,
                OrgContainerId           = base.OrgContainerId,
                OrganizationId           = ((null != base.CurrentOrganizationId) ? base.CurrentOrganizationId : base.ExecutingUserOrganizationId),
                Organization             = this.Organization,
                RolesContainerId         = this.rolesContainerId,
                ServicePlanSettings      = base.ServicePlanSettings,
                WriteVerbose             = new Task.TaskVerboseLoggingDelegate(base.WriteVerbose),
                WriteError               = new Task.TaskErrorLoggingDelegate(base.WriteError),
                WriteWarning             = new Task.TaskWarningLoggingDelegate(this.WriteWarning),
                LogReadObject            = new RoleUpgradeConfigurationSettings.LogReadObjectDelegate(base.LogReadObject),
                LogWriteObject           = new RoleUpgradeConfigurationSettings.LogWriteObjectDelegate(base.LogWriteObject),
                RemoveRoleAndAssignments = new RoleUpgradeConfigurationSettings.RemoveRoleAndAssignmentsDelegate(this.RemoveRoleAndAssignments),
                Task = this
            };

            this.RenameEndUserRolesForUnifiedRAP();
            using (List <RoleNameMapping> .Enumerator enumerator = mapping.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    RoleNameMapping map = enumerator.Current;
                    if (!map.IsSplitting && !map.IsDeprecatedRole)
                    {
                        List <RoleDefinition> list2 = roleDefinitions.ToList <RoleDefinition>().FindAll((RoleDefinition x) => x.RoleName.Equals(map.NewName));
                        if (list2 != null && list2.Count <RoleDefinition>() > 0)
                        {
                            RoleUpgrader roleUpgrader = RoleUpgraderFactory.GetRoleUpgrader(settings, map, list2[0]);
                            roleUpgrader.UpdateRole(list2[0]);
                        }
                    }
                }
            }
            List <RoleDefinition> list3 = new List <RoleDefinition>();

            foreach (RoleDefinition roleDefinition in roleDefinitions)
            {
                if (!list.Contains(roleDefinition))
                {
                    if (!string.IsNullOrEmpty(roleDefinition.ParentRoleName))
                    {
                        list3.Add(roleDefinition);
                    }
                    else
                    {
                        new List <RoleNameMapping>();
                        List <RoleNameMapping> nonRenamingMappings = mapping.GetNonRenamingMappings(roleDefinition.RoleName);
                        if (nonRenamingMappings != null)
                        {
                            using (List <RoleNameMapping> .Enumerator enumerator2 = nonRenamingMappings.GetEnumerator())
                            {
                                while (enumerator2.MoveNext())
                                {
                                    RoleNameMapping roleNameMapping = enumerator2.Current;
                                    if (roleNameMapping.NewNames == null)
                                    {
                                        throw new InvalidOperationException("Invalid MAP:" + roleNameMapping.OldName);
                                    }
                                    RoleUpgrader          roleUpgrader2 = RoleUpgraderFactory.GetRoleUpgrader(settings, roleNameMapping, roleDefinition);
                                    List <RoleDefinition> list4         = new List <RoleDefinition>();
                                    list4 = this.GetRoleDefinitionsByName(roleDefinitions, roleNameMapping.NewNames);
                                    if (roleNameMapping.IsSplitting)
                                    {
                                        list4.Add(roleDefinition);
                                    }
                                    roleUpgrader2.UpdateRoles(list4);
                                    foreach (RoleDefinition item in list4)
                                    {
                                        List <RoleNameMapping> nonRenamingMappings2 = mapping.GetNonRenamingMappings(item.RoleName);
                                        if (nonRenamingMappings2 == null)
                                        {
                                            list.Add(item);
                                        }
                                        else if (nonRenamingMappings2.Count == 1 && nonRenamingMappings2[0].Equals(roleNameMapping))
                                        {
                                            list.Add(item);
                                        }
                                    }
                                }
                                goto IL_363;
                            }
                        }
                        RoleUpgrader roleUpgrader3 = RoleUpgraderFactory.GetRoleUpgrader(settings, null, roleDefinition);
                        roleUpgrader3.UpdateRole(roleDefinition);
                    }
                }
                IL_363 :;
            }
            this.InstallCustomRoles(list3);
            TaskLogger.LogExit();
        }
 protected SplitRoleUpgrader(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping) : base(settings, roleNameMapping)
 {
 }
Esempio n. 8
0
 protected NonDeprecatedRoleUpgrader(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping) : base(settings, roleNameMapping)
 {
 }
Esempio n. 9
0
 protected MailboxPlanRoleUpgrader(RoleUpgradeConfigurationSettings settings, RoleNameMapping roleNameMapping) : base(settings, roleNameMapping)
 {
 }