Exemplo n.º 1
0
        private PowerShellResults <ExtendedOrganizationalUnit> GetOrganizationalUnit(string ou, PowerShellResults <AdminRoleGroupRow> results)
        {
            OrganizationalUnits organizationalUnits = new OrganizationalUnits();
            Identity            identity            = new Identity(ou, ou);

            return(results.MergeErrors <ExtendedOrganizationalUnit>(organizationalUnits.GetObject(identity)));
        }
Exemplo n.º 2
0
        public PowerShellResults <AdminRoleGroupRow> NewObject(NewAdminRoleGroupParameter properties)
        {
            properties.FaultIfNull();
            PowerShellResults <AdminRoleGroupRow> powerShellResults = new PowerShellResults <AdminRoleGroupRow>();

            if (properties.IsScopeModified)
            {
                if (properties.IsOrganizationalUnit)
                {
                    if (string.IsNullOrEmpty(properties.ManagementScopeId))
                    {
                        throw new FaultException(Strings.InvalidOrganizationalUnit(properties.ManagementScopeId));
                    }
                    OrganizationalUnits organizationalUnits = new OrganizationalUnits();
                    Identity            identity            = new Identity(properties.ManagementScopeId, properties.ManagementScopeId);
                    PowerShellResults <ExtendedOrganizationalUnit> powerShellResults2 = powerShellResults.MergeErrors <ExtendedOrganizationalUnit>(organizationalUnits.GetObject(identity));
                    if (powerShellResults.Failed)
                    {
                        return(powerShellResults);
                    }
                    ExtendedOrganizationalUnit value = powerShellResults2.Value;
                    properties.RecipientOrganizationalUnitScope = new Identity(value.Id, value.Name);
                }
                else
                {
                    PowerShellResults <ManagementScopeRow> managementScope = this.GetManagementScope(properties.ManagementScopeId, powerShellResults);
                    if (powerShellResults.Failed)
                    {
                        return(powerShellResults);
                    }
                    if (managementScope != null && managementScope.SucceededWithValue)
                    {
                        ManagementScopeRow value2 = managementScope.Value;
                        if (value2.ScopeRestrictionType == ScopeRestrictionType.RecipientScope)
                        {
                            properties.RecipientWriteScope = value2.Identity;
                        }
                        else if (value2.ScopeRestrictionType == ScopeRestrictionType.ServerScope)
                        {
                            properties.ConfigWriteScope = value2.Identity;
                        }
                    }
                }
            }
            powerShellResults = base.NewObject <AdminRoleGroupRow, NewAdminRoleGroupParameter>("New-RoleGroup", properties);
            if (powerShellResults.Succeeded && powerShellResults.HasWarnings)
            {
                powerShellResults.Warnings = null;
            }
            return(powerShellResults);
        }