[Date Prev][Date Next] [Chronological] [Thread] [Top]

Antw: how to get list of valid attributes



>>> Umar Draz <unix.co@gmail.com> schrieb am 18.02.2014 um 20:43 in Nachricht
<CAAKRE73BE3w2ocwrpiADBzA7COMPJ0FQ_EBPLnpNLfU7gxuAUQ@mail.gmail.com>:
> HI All
> 
> I want a list of valid attributes for specific objectClass e.g.

In Perl, you could use $schema->may($oc) to get the optionaly attributes for object class $oc ($schema->must($oc) gets the mandatory attributes).
You get the schema for the object class $oc with $schema->objectclass($oc), while you get the schema itself with $schema = $ldap->schema() wher $ldap is the LDAP connection object. The ldap connection object is created by Net::LDAP->new($host).

> 
> I have a user abc with the dn of this user is
> 
> cn=Abc User,ou=accounts,dc=mydom,dc=com
> 
> the abc user has these object classes
> 
> posixAccount
> shadowAccount
> OrginizatinalPerson
> yubikeyUser
> 
> now I want to get the valid schema attribute of yubikeyUser for only the
> above mentioned user.

You would get the objectClass attribute first, collecting the objectclasses, the you unite the MUST and MAY attributes you get as described above.
Basically the schema is based on classes, not on objects, but you can derive the classes from the objects.

> 
> Is this possible?

I'd say: Yes.

> 
> Umar