directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Suriarachchi <amilasuriarach...@gmail.com>
Subject Modifing attributes
Date Mon, 15 Feb 2010 10:29:01 GMT
hi,

I have created a different partition and added an entry with the following
code

// create a partition for this tenant
        JdbmPartition partition = new JdbmPartition();
        partition.setId("wso2.com");
        partition.setSuffix("dc=wso2,
dc=com");

        Set<Index<?, ServerEntry>> indexedAttrs = new HashSet<Index<?,
ServerEntry>>();
        indexedAttrs.add(new JdbmIndex<String, ServerEntry>("ou"));
        indexedAttrs.add(new JdbmIndex<String, ServerEntry>("dc"));
        indexedAttrs.add(new JdbmIndex<String, ServerEntry>("objectClass"));
        partition.setIndexedAttributes(indexedAttrs);

        try {
            directoryService.addPartition(partition);
            try {

directoryService.getAdminSession().lookup(partition.getSuffixDn());
            } catch (Exception e) {
                LdapDN tenantdn = new LdapDN("dc=wso2,dc=com");
                ServerEntry tenantEntry =
directoryService.newEntry(tenantdn);
                tenantEntry.add("objectClass", "top", "organization",
"extensibleObject");
                tenantEntry.add("o", tenant.getDomain());
                tenantEntry.add("manager", "uid=admin," +
partition.getSuffix());
                tenantEntry.add("administrativeRole",
"accessControlSpecificArea");

                directoryService.getAdminSession().add(tenantEntry);

how can I modify the manager attribute value to
eg. "uid=amila," + partition.getSuffix() after adding that entry

I tried with following code

Modification modification = new
ServerModification(ModificationOperation.REPLACE_ATTRIBUTE, entryAttribute);
                List<Modification> modifications = new
ArrayList<Modification>();
                modifications.add(modification);
                this.directoryService.getAdminSession().modify(tenantDN,
modifications);

Here how can I create the entryAttribute? how can I set the new value for
that?

Can someone please help me?

thanks,
Amila.


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message