Exemple #1
0
        internal static RoleGroup PopulateRoleAssignmentsAndConvert(ADGroup group, IConfigurationSession configurationSession)
        {
            Result <ExchangeRoleAssignment>[] roleAssignmentResults = null;
            if (RoleGroup.ContainsRoleAssignments(group))
            {
                return(new RoleGroup(group, roleAssignmentResults));
            }
            SharedConfiguration sharedConfiguration = SharedConfiguration.GetSharedConfiguration(group.OrganizationId);
            RoleGroup           roleGroup;

            if (sharedConfiguration != null)
            {
                if (group.RoleGroupType == RoleGroupType.PartnerLinked)
                {
                    roleGroup = new RoleGroup(group, null);
                }
                else
                {
                    ADObjectId   sharedConfiguration2 = null;
                    ADObjectId[] sharedRoleGroupIds;
                    if (group.IsModified(ADObjectSchema.Name))
                    {
                        sharedRoleGroupIds = sharedConfiguration.GetSharedRoleGroupIds(new ADObjectId[]
                        {
                            group.OriginalId
                        });
                    }
                    else
                    {
                        sharedRoleGroupIds = sharedConfiguration.GetSharedRoleGroupIds(new ADObjectId[]
                        {
                            group.Id
                        });
                    }
                    if (sharedRoleGroupIds != null && sharedRoleGroupIds.Length != 0)
                    {
                        IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, sharedConfiguration.GetSharedConfigurationSessionSettings(), 171, "PopulateRoleAssignmentsAndConvert", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RBAC\\RoleGroup\\RoleGroupCommon.cs");
                        roleAssignmentResults = tenantOrTopologyConfigurationSession.FindRoleAssignmentsByUserIds(new ADObjectId[]
                        {
                            sharedRoleGroupIds[0]
                        }, false);
                        sharedConfiguration2 = sharedConfiguration.SharedConfigurationCU.Id;
                    }
                    roleGroup = new RoleGroup(group, roleAssignmentResults);
                    roleGroup.SharedConfiguration = sharedConfiguration2;
                }
            }
            else
            {
                configurationSession.SessionSettings.IsSharedConfigChecked = true;
                roleAssignmentResults = configurationSession.FindRoleAssignmentsByUserIds(new ADObjectId[]
                {
                    group.Id
                }, false);
                roleGroup = new RoleGroup(group, roleAssignmentResults);
            }
            return(roleGroup);
        }