Gets the list of users who are members of a group (or the list of groups to which a user belongs).
Syntax
ESS_FUNC_M EssGetGroupList (hCtx, GroupName, pCount, ppUserList);
| Parameter | Data Type | Description |
|---|---|---|
hCtx | ESS_HCTX_T | API context handle. |
GroupName | ESS_USERNAME_T | User name or group name. |
pCount | ESS_PUSHORT_T | Address of variable to receive count of user names. |
ppUserList | ESS_PPUSERNAME_T | Address of pointer to receive allocated array of user name strings. |
Notes
This function can also be used to get the list of groups to which a user belongs, by using a user name as the GroupName argument.
The memory allocated for ppUserList should be freed using EssFree().
Return Value
If successful, returns a count of user names in pCount, and a array of user name strings in ppUserList.
Access
This function requires the caller to have Create/Delete User privilege (ESS_PRIV_USERCREATE) for the logged in server, unless they are a user getting their own list of groups.
Example
ESS_FUNC_M
ESS_ListGroupUsers (ESS_HCTX_T hCtx,
ESS_HINST_T hInst
)
{
ESS_FUNC_M sts = ESS_STS_NOERR;
ESS_PUSERNAME_T UserList = NULL;
ESS_USHORT_T ind;
ESS_USHORT_T Items;
ESS_USERNAME_T GroupName;
strcpy(Groupname, "PowerUsers");
sts = EssGetGroupList (hCtx, GroupName, &Items, &UserList);
if (!sts)
{
if (Items && UserList)
{
printf ("\r\n-------%s User List-------\r\n\r\n", GroupName);
for (ind = 0; ind < Items; ind++)
{
if (UserList [ind])
printf ("%s\r\n", UserList [ind]);
}
EssFree (hInst, UserList);
}
else
printf ("\r\nUsers list is empty\r\n\r\n");
}
return (sts);
}See Also