- if (getDirectory().getGroupBaseRdn().equals(technicalRdn))
- res = newGroup(name, null);
- else if (getDirectory().getSystemRoleBaseRdn().equals(technicalRdn))
- res = newGroup(name, null);
- else if (getDirectory().getUserBaseRdn().equals(technicalRdn))
- res = newUser(name, null);
- else
- res = new DefaultLdapEntry(getDirectory(), name, null);
-// if (isGroup(name))
-// res = newGroup(name, attrs);
-// else
-// res = newUser(name, attrs);
-// else
-// throw new IllegalArgumentException("Unsupported LDAP type for " + name);
+ if (getDirectory().getGroupBaseRdn().equals(technicalRdn)) {
+ if (attrs.size() == 0) {// exists but not accessible
+ attrs = new BasicAttributes();
+ attrs.put(LdapAttrs.objectClass.name(), LdapObjs.top.name());
+ attrs.put(LdapAttrs.objectClass.name(), getDirectory().getGroupObjectClass());
+ }
+ res = newGroup(name, attrs);
+ } else if (getDirectory().getSystemRoleBaseRdn().equals(technicalRdn)) {
+ if (attrs.size() == 0) {// exists but not accessible
+ attrs = new BasicAttributes();
+ attrs.put(LdapAttrs.objectClass.name(), LdapObjs.top.name());
+ attrs.put(LdapAttrs.objectClass.name(), getDirectory().getGroupObjectClass());
+ }
+ res = newGroup(name, attrs);
+ } else if (getDirectory().getUserBaseRdn().equals(technicalRdn)) {
+ if (attrs.size() == 0) {// exists but not accessible
+ attrs = new BasicAttributes();
+ attrs.put(LdapAttrs.objectClass.name(), LdapObjs.top.name());
+ attrs.put(LdapAttrs.objectClass.name(), getDirectory().getUserObjectClass());
+ }
+ res = newUser(name, attrs);
+ } else {
+ res = new DefaultLdapEntry(getDirectory(), name, attrs);
+ }