Adds a user to the specified group. Similar to EssAddToGroup, but can accept a user directory specification or unique identity attribute for GroupId or UserId.
Syntax
ESS_FUNC_M EssAddToGroupEx (hCtx, GroupId, UserId, bUsingIdentity);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle (input). |
GroupId | ESS_STR_T | Group name or identity (input). Can be specified as groupname@provider or as a unique identity attribute. |
bIsGroupId | ESS_BOOL_T | Input. Indicates if GroupId is a name or an identity. If TRUE, GroupId is an identity. |
UserId | ESS_STR_T | Name of user to add to group (input). Can be specified as username@provider or as a unique identity attribute. |
bUsingIdentity | ESS_BOOL_T | Input. Indicates if UserID is a name or an identity. If TRUE, UserID is an identity. |
Notes
The API can accept an identity or a group name. The group name can be specified as groupname@provider.
Return Value
None.
Access
This function requires the caller to have Create/Delete User privilege (ESS_PRIV_USERCREATE) for the logged in server.
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_AddUser (ESS_HCTX_T hCtx) { ESS_STS_T sts = ESS_STS_NOERR; ESS_STR_T groupId, userId; ESS_BOOL_T bGroupId, bUserId; ESS_BOOL_T bisIdentity; ESS_USHORT_T type; ESS_USHORT_T count; ESS_BOOL_T bUsingIdentity; ESS_PSTR_T pUserList; groupId = "IDRegularGroup@ldap"; bGroupId = ESS_FALSE; userId = "IDUser6"; bUserId = ESS_FALSE; sts = EssAddToGroupEx(hCtx, groupId, bGroupId, userId, bUserId); printf("EssAddToGroupEx sts: %ld\n", sts); if(!sts) { 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