EssGetGroupListEx

Gets the list of users who are members of a group or the list of groups to which the user belongs. Similar to EssGetGroupList, but can accept a user directory specification or unique identity attribute for GroupName.

Syntax

ESS_FUNC_M EssGetGroupListEx (hCtx, GroupName, bIsIdentity, entityType, pCount, bOutputInIds, ppUserList);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle (input).

GroupName

ESS_STR_T

Group name or identity (input). Can be specified as groupname@provider or as a unique identity attribute.

bIsIdentity

ESS_BOOL_T

Input. Indicates if GroupName is a name or an identity. If TRUE, GroupName is an identity.

entityType

ESS_USHORT_T

Type of entity (input). Can be one of the following:

  • ESS_TYPE_USER – Returns the list of groups to which this user belongs

  • ESS_TYPE_GROUP – Returns the list of users to which this group belongs

pCount

ESS_PUSHORT_T

Address of variable to receive count of user names (output).

bOutputInIds

ESS_BOOL_T

Input. Indicates whether the output must be in identities. If TRUE, ppUserList returns an array of identities.

ppUserList

ESS_PSTR_T

Address of pointer to receive allocated array of user name strings or identities (output).

Notes

Return Value

If successful, returns a count of user names in pCount, and a array of user name strings or identities 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

void DisplayUserList(ESS_USHORT_T count, ESS_PSTR_T UserList)
{
	ESS_USHORT_T i;

	for (i = 0; i < count; i++)
	{   
		if (UserList [i]) 
			printf ("%s\n", UserList[i]);
	}
}


ESS_FUNC_M ESS_ListGroupUsers (ESS_HCTX_T hCtx, ESS_HINST_T hInst)
{
   ESS_STS_T sts = ESS_STS_NOERR;
   ESS_STR_T groupId;
   ESS_BOOL_T bisIdentity;
   ESS_USHORT_T type;
   ESS_USHORT_T count;
   ESS_BOOL_T bUsingIdentity;
   ESS_PSTR_T pUserList;

   groupId = "IDAdminGroup";
   bisIdentity = ESS_TRUE;
   type = ESS_TYPE_GROUP;
   sts = EssGetGroupListEx(hCtx, groupId, bisIdentity, type, &count, &bUsingIdentity, &pUserList);
   printf("EssGetGroupListEx sts: %ld\n", sts);
   if(!sts)
   {
      if(pUserList)
      {
         printf ("\n---User/Group list for %s:\n", groupId);      
         DisplayUserList(count, pUserList);
      }
      else
         printf ("\tUser list is empty\n");
   }
       
   return (sts);
}

See Also