directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: Got more than one attributeType for oid of "uidNumber"
Date Sun, 21 Dec 2008 01:32:41 GMT
hayart wrote:
> Hi
>   
Hi,

The PosixAccount ObjectClass already exists in ADS. It's related to the 
'nis' schema. You just have to activate it to use it, no need to create 
it again.

Here is the code you have to use to activate the 'nis' schema :

        LdapContext schemaRoot = getSchemaContext( service );
        Attributes nisAttrs = schemaRoot.getAttributes( "cn=nis" );
        boolean isNisDisabled = false;

        if ( nisAttrs.get( "m-disabled" ) != null )
        {
            isNisDisabled = ( ( String ) nisAttrs.get( "m-disabled" 
).get() ).equalsIgnoreCase( "TRUE" );
        }

        // if nis is disabled then enable it
        if ( isNisDisabled )
        {
            Attribute disabled = new BasicAttribute( "m-disabled" );
            ModificationItem[] mods = new ModificationItem[] {
                new ModificationItem( DirContext.REMOVE_ATTRIBUTE, 
disabled ) };
            schemaRoot.modifyAttributes( "cn=nis", mods );
        }

where schemaRoot is a context pointing on "ou=schema"


-- 
--
cordialement, regards,
Emmanuel L├ęcharny
www.iktek.com
directory.apache.org



Mime
View raw message