Changes

stoney core: Search Resource Mapping (REST - LDAP)

7,783 bytes added, 13:29, 25 May 2014
/* People Search (GET) */
= stoney core: search resource methods =
== Resellers Global Search (GET) ==The following sequence describes global search only incorporates a subset of attributes in the resellers search. Detailed examples are described under [[stoney core:Global Searches]].
Restrictions.
* To limit the hits per search, the default number of results is set to '''5''' per resource.
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 [[stoney_core:_OpenLDAP_directory_data_organisation#Reseller | ou=reseller,dc=stoney-cloud,dc=org]]. The actual LDIF of a reseller is described under [[stoney_core:_OpenLDAP_directory_data_organisation#Reseller_uid_.28per_Reseller.29 | 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''' (GETscope is one, size limit is set to 5):<pre>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</pre> The possible answer could look as follows:<pre>dn: uid=4000000,ou=reseller,dc=stoney-cloud,dc=orguid: 4000000o: Reseller Ltd.sstIsCompany: TRUEsstIsActive: TRUE</pre> ==== 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):<pre>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</pre> The possible answer could look as follows:<pre>dn: ou=address,uid=4000000,ou=reseller,dc=stoney-cloud,dc=orgc: CHpostalCode: Postal Codel: Locality</pre> === 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'''.
{| border="1" class="wikitable sortable"
! API Attribute
! LDAP Attribute
|-
 
| id
| uid
|-
 | isCompany| sstIsCompany|- | isActive| sstIsActive|- | userresellerName| mailorganizationName (o)
|-
|}
As described above, the second set of attributes are retrieved from '''ou=address,uid= Customers <UID>,ou=reseller,dc=stoney-cloud,dc=org'''.{| border="1" class="wikitable sortable"! API Attribute! LDAP Attribute|- | countryCode| countryName (c)|-  | postalCode| postalCode|-  | localityName| localityName|- |} == Global Search Response Object (GETstoney core: Customers Resource) ==All the customers are stored under the sub tree [[stoney_core:_OpenLDAP_directory_data_organisation#Customers | ou=customers,dc=stoney-cloud,dc=org]]. The actual LDIF of a customer is described under [[stoney_core:_OpenLDAP_directory_data_organisation#Customers_uid_.28per_customer.29 | Customer uid (per Customer)]]. The following LDAP attributes must be included in the search:* uid (id)* sstExternalID (externalID)* organizationName (Company customer: This is the normal case, as we target companies (customerName = organizationName)).* givenName (Private customer: A private customer does not have a company/organisation name (customerName = givenName surname)).* surname (Private customer: A private customer does not have a company/organisation name (customerName = givenName surname)). The following LDAP attributes must be returned:* uid (id)* sstIsCompany (isCompany)* sstIsActive (isActive)* organizationName (customerName) or givenName and surname (customerName)* countryName (countryCode)* postalCode (postalCode)* localityName (localityName)* sstBelongsToResellerUID (belongsToResellerID) === Sequence ===The following sequence describes the resellers search. ==== Search for the entered string ====We presume, that the string to be searched for is '''cus''' (scope is one, size limit is set to 5):<pre>ldapsearch -H ldaps://ldapm.stoney-cloud.org \ -b "ou=customers ,dc=stoney-cloud,dc=org" \ -s one \ -D "cn=Manager,dc=stoney-cloud,dc=org" \ -z 5 \ -W -x -LLL \ "(|(uid=*cus*)(organizationName=*cus*)(sstExternalID=*cus*))" uid sstIsCompany sstIsActive organizationName givenName surname sstBelongsToResellerUID</pre> The possible answer could look as follows:<pre>dn: uid=4000001,ou=customers,dc=stoney-cloud,dc=orguid: 4000001o: Customer Ltd.sstIsCompany: TRUEsstIsActive: TRUEsstBelongsToResellerUID: 4000000</pre> ==== Create a second searchfor 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):<pre>ldapsearch -H ldaps://ldapm.stoney-cloud.org \ -b "ou=address,uid=4000001,ou=customers,dc=stoney-cloud,dc=org" \ -s base \ -D "cn=Manager,dc=stoney-cloud,dc=org" \ -z 5 \ -W -x -LLL \ "(objectclass=*)" countryName postalCode localityName</pre> The possible answer could look as follows:<pre>dn: ou=address,uid=4000001,ou=customers,dc=stoney-cloud,dc=orgc: CHpostalCode: Postal Codel: Locality</pre>
=== Customers Global Search Response Object (GETstoney core: Customers Resource) Mapping ===
{| border="1" class="wikitable sortable"
! API Attribute
|}
== Global Search Response Object (stoney core: People Resource) ==
All the people are stored under the sub tree [[stoney_core:_OpenLDAP_directory_data_organisation#People | ou=people,dc=stoney-cloud,dc=org]]. The actual LDIF of a person is described under [[stoney_core:_OpenLDAP_directory_data_organisation#People_uid_.28per_person.29 | People uid (per Person)]].
 
The following LDAP attributes must be included in the search:
* uid (id)
* givenName (givenName)
* surname (surname)
 
The following LDAP attributes must be returned:
* uid (id)
* sstIsActive (isActive)
* givenName (givenName)
* surname (surname)
* organizationName (customerName) or givenName and surname (customerName), the same logic applies as for the customer search
* sstBelongsToResellerUID (belongsToResellerID)
* sstBelongsToCustomerUID (belongsToCustomerID)
 
=== Sequence ===
The following sequence describes the people search.
 
==== Search for the entered string ====
We presume, that the string to be searched for is '''sto''' (scope is one, size limit is set to 5):
<pre>
ldapsearch -H ldaps://ldapm.stoney-cloud.org \
-b "ou=people,dc=stoney-cloud,dc=org" \
-s one \
-D "cn=Manager,dc=stoney-cloud,dc=org" \
-z 5 \
-W -x -LLL \
"(|(uid=*sto*)(givenName=*sto*)(surname=*sto*))" uid sstIsActive givenName surname sstBelongsToResellerUID sstBelongsToCustomerUID
</pre>
 
The possible answer could look as follows:
<pre>
dn: uid=4000002,ou=people,dc=stoney-cloud,dc=org
uid: 4000002
givenName: stoney cloud
sn: Administrator
sstIsActive: TRUE
sstBelongsToResellerUID: 4000000
sstBelongsToCustomerUID: 4000001
</pre>
 
==== Create a second search for each result ====
As we are interested, to which customer the person belongs to, we need to execute a second search (scope is base):
<pre>
ldapsearch -H ldaps://ldapm.stoney-cloud.org \
-b "uid=4000001,ou=customers,dc=stoney-cloud,dc=org" \
-s base \
-D "cn=Manager,dc=stoney-cloud,dc=org" \
-z 5 \
-W -x -LLL \
"(objectclass=*)" organizationName givenName surname
</pre>
The possible answer could look as follows:<pre>dn: uid=4000001,ou= People Search (GET) customers,dc=stoney-cloud,dc=orgThe following sequence describes the people searcho:Customer Ltd.</pre>
=== People Global Search Response Object (GETstoney core: People Resource) Mapping ===
{| border="1" class="wikitable sortable"
! API Attribute
SLB, editor, reviewer
3,368
edits