directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "St Clair S. Clarke" <st_cl...@flowja.com>
Subject Adding a baseDN with GroovyLdap
Date Thu, 27 May 2010 14:27:53 GMT
Hello,

I am attempting to add a baseDN using ApacheDS and Eclipse, but have
been failing miserable.

Below is the attempt.   I would love it if you could help.


package snippets.security.ldap.groovyldap.add

import org.apache.directory.groovyldap.LDAP

class AddEntryDemo
{
    
    static main( args)
    {
        def ldap = LDAP.newInstance('ldap://localhost:10389', 'uid=admin, ou=system' ,'secret')
        
        // add the baseDN as a valid name entry
        def baseDNAttrs = [ objectclass: ['top', 'ou'], sn: 'dc=epims dc=biz', cn: 'epims'
]
        ldap.add( 'ou: epims dc=epims dc=biz', baseDNAttrs)
        
        assert ! ldap.exists('cn=Heather Nova, dc=epims, dc=biz') // checks for previous entry
with this dn
        
        
        
        
        // define the attributes as a map
        def attrs = [ objectclass: ['top', 'person'], sn: 'Nova', cn: 'Heather Nova' ]
        
        ldap.add( 'cn=Heather Nova, dc=epims, dc=biz', attrs)
        
        assert ldap.exists('cn=Heather Nova, dc=epims, dc=com')
        
    }
    
    
}








---------------------------------------------------------
Dr. St Clair S. Clarke (M.B.B.S; D.M. (General Surgery) )
Head, General Surgery Department
Spanish Town General Hospital
Burk Road,
Spanish Town
St Catherine
Jamaica

Phone:(876) 984-3030/5
Phone:(876) 984-4670/2
Phone:(876) 749-2213 (Direct)
Fax:(876) 749-2213

Mobile: (876) 303-6177
Email: st_clair@flowja.com
Skype: st.clair.clarke


Mime
View raw message