Description:
This tech details the steps that a programmer/administrator would need to perform to get all roles of a specific contact from web service calls. This role information is needed in many integrated applications but currently there is no direct web service method providing a complete list.
Solution:
A role can be associated/attached to a user either directly or thru access type.
Therefore, in order to get a complete list of roles, you would need to perform both of the following:
- thru access type
1.1 call getHandleForUserid() to get the user handle/persid of a specific
user. You would need to pass sid and userid/system-login-id for this call
1.2 call getAccessTypeForContact() to get the access type
you would need sid and the user handle from 1.1 for this call and it will
return the access type as acctyp:xxxxx, where xxxxx is the id of that access
type
1.3 call doSelect() to query all roles of the access type
objectType should be "acctyp_role"
whereClause should be "access_type=xxxxx"
return string should be "role_obj"
this call should return a list of "role_obj"s
1.4 for each role_obj returned from 1.3, call doSelect() to query it name
objectType should be "role"
whereClause should be "id=yyyyyy"
return string should be "name"
(where yyyyyy is the role_obj from 1.3)
the call will return the role name
- directly
2.1 same as 1.1
2.2 call doSelect() to query all roles of the specific user
objectType should be "cnt_role"
whereClause should be "contact=U'zzzzzzz'
return string should be "role_obj"
this call should return a list of "role_obj"s
(where zzzzzzz is the uuid of the user, which is splited from the user handle
from 2.1. 2.1 will return cnt:zzzzzzz)
2.3 same as 1.4
Combine the names from 1.4 and 2.3, you will get the names of the roles for the specific contact.