Difference between revisions of "stoney core: Search Resource Mapping (REST - LDAP)"

From stoney cloud
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Search for the entered string)
(Create a second search for each result)
Line 59: Line 59:
 
   -s base \
 
   -s base \
 
   -D "cn=Manager,dc=stoney-cloud,dc=org" \
 
   -D "cn=Manager,dc=stoney-cloud,dc=org" \
 +
  -z 5 \
 
   -W -x -LLL \
 
   -W -x -LLL \
 
   "(objectclass=*)" countryName postalCode localityName
 
   "(objectclass=*)" countryName postalCode localityName

Revision as of 12:44, 25 May 2014

Also visit stoney core: Search Resource - REST API and stoney core: Global Searches.

Overview

stoney core: search resource methods

Global Search (GET)

The global search only incorporates a subset of attributes in the search. Detailed examples are described under stoney core: Global Searches.

Do not forget to restrict the search according to the person who is currently logged in.

  • A provider (users with the attribute sstBelongsToUID=1) can search the whole directory.
  • A reseller (sstBelongsToResellerUID: <UID>) can only see entries, with the corresponding sstBelongsToResellerUID attribute.
  • A customer (sstBelongsToCustomerUID: <UID>) can only see entries, with the corresponding sstBelongsToCustomerUID attribute.

Global Search Response Object (stoney core: Resellers Resource)

All the resellers are stored under the sub tree ou=reseller,dc=stoney-cloud,dc=org. The actual LDIF of a reseller is described under Reseller uid (per Reseller).

The following LDAP attributes must be included in the search:

  • uid (id)
  • organizationName (resellerName)

The following LDAP attributes must be returned:

  • uid (id)
  • sstIsCompany (isCompany)
  • sstIsActive (isActive)
  • organizationName (resellerName)
  • countryName (countryCode)
  • postalCode (postalCode)
  • localityName (localityName)

Sequence

The following sequence describes the resellers search.

Search for the entered string

We presume, that the string to be searched for is res (scope is one, size limit is set to 5):

ldapsearch -H ldaps://ldapm.stoney-cloud.org \
  -b "ou=reseller,dc=stoney-cloud,dc=org" \
  -s one \
  -D "cn=Manager,dc=stoney-cloud,dc=org" \
  -z 5 \
  -W -x -LLL \
  "(|(uid=*res*)(organizationName=*res*))" uid sstIsCompany sstIsActive organizationName

The possible answer could look as follows:

dn: uid=4000000,ou=reseller,dc=stoney-cloud,dc=org
uid: 4000000
o: Reseller Ltd.
sstIsCompany: TRUE
sstIsActive: TRUE

Create a second search for each result

As some of the attributes we're interested in are in the address sub tree, we need to execute a second search (scope is base):

ldapsearch -H ldaps://ldapm.stoney-cloud.org \
  -b "ou=address,uid=4000000,ou=reseller,dc=stoney-cloud,dc=org" \
  -s base \
  -D "cn=Manager,dc=stoney-cloud,dc=org" \
  -z 5 \
  -W -x -LLL \
  "(objectclass=*)" countryName postalCode localityName

The possible answer could look as follows:

dn: ou=address,uid=4000000,ou=reseller,dc=stoney-cloud,dc=org
c: CH
postalCode: Postal Code
l: Locality

Global Search Response Object (stoney core: Resellers Resource) Mapping

As described above, the first attributes are retrieved from uid=<UID>,ou=reseller,dc=stoney-cloud,dc=org.

API Attribute LDAP Attribute
id uid
isCompany sstIsCompany
isActive sstIsActive
resellerName organizationName (o)

As described above, the second set of attributes are retrieved from ou=address,uid=<UID>,ou=reseller,dc=stoney-cloud,dc=org.

API Attribute LDAP Attribute
countryCode countryName (c)
postalCode postalCode
localityName localityName

Global Search Response Object (stoney core: Customers Resource)

The following sequence describes the customers search:


Global Search Response Object (stoney core: Customers Resource) Mapping

API Attribute LDAP Attribute
id uid
user mail


People Search (GET)

The following sequence describes the people search:


People Search (GET) Mapping

API Attribute LDAP Attribute
id uid
user mail

Links