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


Reply via email to