public LdapUser getUserTemplate ( String uid ) { LdapUser user = new LdapUser ( uid , this ) ; user . set ( "dn" , getDNForNode ( user ) ) ; for ( String oc : userObjectClasses ) { user . addObjectClass ( oc . trim ( ) ) ; } user = ( LdapUser ) updateObjectClasses ( user ) ; // TODO this needs to be cleaner :-/. // for inetOrgPerson if ( user . getObjectClasses ( ) . contains ( "inetOrgPerson" ) || user . getObjectClasses ( ) . contains ( "person" ) ) { user . set ( "sn" , uid ) ; } // for JabberAccount if ( user . getObjectClasses ( ) . contains ( "JabberAccount" ) ) { user . set ( "jabberID" , uid + "@" + defaultValues . get ( "jabberServer" ) ) ; user . set ( "jabberAccess" , "TRUE" ) ; } // for posixAccount if ( user . getObjectClasses ( ) . contains ( "posixAccount" ) ) { user . set ( "uidNumber" , "99999" ) ; user . set ( "gidNumber" , "99999" ) ; user . set ( "cn" , uid ) ; user . set ( "homeDirectory" , "/dev/null" ) ; } // for ldapPublicKey if ( user . getObjectClasses ( ) . contains ( "ldapPublicKey" ) ) { user . set ( "sshPublicKey" , defaultValues . get ( "sshKey" ) ) ; } return user ; }
Returns a basic LDAP - User - Template for a new LDAP - User .