LDAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesLDAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 27th, 2009, 03:36 PM
sharvancik sharvancik is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 2 sharvancik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 21 m 3 sec
Reputation Power: 0
Using Novels LDAP unable to add leaf that is not a User

Off the Applications container we have stored our Actions and our Application Roles. We are building a new application to allow us to programatically add the role privileges into the LDAP.

I am able to add my actions (an ou entry), but not the final leaf off my actions (a cn entry).

My java code for adding the action (node prior to the role) is:
// This works fine
String newfpRoleDn = preFix + "=" + fpRole + "," + fpRoleDn;
ctx = ldapSearcher.getDirContext();
BasicAttributes attrs = null;
Attribute attr = null;

attrs = new BasicAttributes();
attr = new BasicAttribute(preFix, fpRole);
attrs.put(attr);
attr = new BasicAttribute("objectClass", "organizationalUnit");
attrs.put(attr);

ctx.createSubcontext(newfpRoleDn, attrs);
ctx.close();

My java code for adding the role is something like this:
// this is not working
BasicAttributes myAttrs = new BasicAttributes(true);
Attribute oc = new BasicAttribute("objectclass");
oc.add("top");
oc.add("organizationalRole");
myAttrs.put(oc);
myAttrs.put("cn",newRoleDn);

// When I use bind I get the error:
// [LDAP: error code 17 - Undefined Attribute Type]; remaining name 'ou=ReportAdministrator_EVENSTEVENOLD,ou=DHFSDCFSdWAccess,ou=dWisacwis,ou=Applications,ou='
ctx.bind(roleDn, newRoleDn, myAttrs);
// When I use the createSubcontext I get the error:
// [LDAP: error code 19 - NDS error: syntax violation (-613)]; remaining name 'cn=DHFSDCFSdWReportAdministrator_VVVVEEEEEODS,ou=Re ...
ctx.createSubcontext(newRoleDn, myAttrs);

ctx.close();

I can add organizations, I can add individuals, I can add attributes to organizations or individuals. I can add actions, but I am not able to add an Application Role.

Can someone help me please? Every example I see is adding a person. Not all adds are people.

Thanks

Reply With Quote
  #2  
Old January 28th, 2009, 01:45 PM
sharvancik sharvancik is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 2 sharvancik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 21 m 3 sec
Reputation Power: 0
Quote:
Originally Posted by sharvancik
Off the Applications container we have stored our Actions and our Application Roles. We are building a new application to allow us to programatically add the role privileges into the LDAP.

I am able to add my actions (an ou entry), but not the final leaf off my actions (a cn entry).

My java code for adding the action (node prior to the role) is:
// This works fine
String newfpRoleDn = preFix + "=" + fpRole + "," + fpRoleDn;
ctx = ldapSearcher.getDirContext();
BasicAttributes attrs = null;
Attribute attr = null;

attrs = new BasicAttributes();
attr = new BasicAttribute(preFix, fpRole);
attrs.put(attr);
attr = new BasicAttribute("objectClass", "organizationalUnit");
attrs.put(attr);

ctx.createSubcontext(newfpRoleDn, attrs);
ctx.close();

My java code for adding the role is something like this:
// this is not working
BasicAttributes myAttrs = new BasicAttributes(true);
Attribute oc = new BasicAttribute("objectclass");
oc.add("top");
oc.add("organizationalRole");
myAttrs.put(oc);
myAttrs.put("cn",newRoleDn);

// When I use bind I get the error:
// [LDAP: error code 17 - Undefined Attribute Type]; remaining name 'ou=ReportAdministrator_EVENSTEVENOLD,ou=DHFSDCFSdWAccess,ou=dWisacwis,ou=Applications,ou='
ctx.bind(roleDn, newRoleDn, myAttrs);
// When I use the createSubcontext I get the error:
// [LDAP: error code 19 - NDS error: syntax violation (-613)]; remaining name 'cn=DHFSDCFSdWReportAdministrator_VVVVEEEEEODS,ou=Re ...
ctx.createSubcontext(newRoleDn, myAttrs);

ctx.close();

I can add organizations, I can add individuals, I can add attributes to organizations or individuals. I can add actions, but I am not able to add an Application Role.

Can someone help me please? Every example I see is adding a person. Not all adds are people.

Thanks



Should be able to use the
ctx.createSubcontext(newRoleDn, myAttrs);
but remove the line prior to it

myAttrs.put("cn",newRoleDn);

and it indeed works!!!!!

Reply With Quote
  #3  
Old January 28th, 2009, 04:44 PM
ldapswandog ldapswandog is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Location: Charlotte, NC
Posts: 111 ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 18 m
Reputation Power: 8
I'm not a developer but I know LDAP pretty well. All entries added to LDAP are done the same, you build and LDIF formatted entry and then import it into the Directory server.

My java code for adding the action (node prior to the role) is:
// This works fine
String newfpRoleDn = preFix + "=" + fpRole + "," + fpRoleDn;
ctx = ldapSearcher.getDirContext();
BasicAttributes attrs = null;
Attribute attr = null;

attrs = new BasicAttributes();
attr = new BasicAttribute(preFix, fpRole);
attrs.put(attr);
attr = new BasicAttribute("objectClass", "organizationalUnit");
attrs.put(attr);

ctx.createSubcontext(newfpRoleDn, attrs);
ctx.close();

Now based on your code for adding the ACTION, this is what your variables mean
preFix=ou
fpRole=<name of Action>
fpRoleDn=<ldap base you want to add Action to>
BasicAttribute Objectclass=organizationalUnit

This will build an LDIF entry like;

dn: ou=MyAction,dc=MyDomain,dc=com
objectclass: organizationalUnit
ou: MyAction

So to add a ROLE (cn=) will be the same code different vaiable values

preFix=cn
fpRole=<name of Role>
fpRoleDn=<ldap base you want to add Role to which is now ou=MyAction,dc=MyDomain,dc=com>
BasicAttribute Objectclass=organizationalRole

This will now build an LDIF entry like;

dn: cn=Myrole,ou=MyAction,dc=MyDomain,dc=com
objectclass: organizationalRole
cn: Myrole

NOTE: objectclass=organizationalRole may have other REQUIRED attributes.
Objectclass=organizationalUnit only requires attributes (objectclass, ou)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesLDAP Programming > Using Novels LDAP unable to add leaf that is not a User

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap