EssDeleteFromGroupEx

Removes a user from a group. Similar to EssDeleteFromGroup, but can accept a user directory specification or unique identity attribute for GroupId or UserId.

Syntax

ESS_FUNC_M EssDeleteFromGroupEx (hCtx, GroupId, bIsGroupId, UserId, bUsingIdentity);
ParameterData TypeDescription

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 remove from 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

As well as deleting the specified user from the list of members for the specified group, this function also deletes the group from the user's own list of associated groups.

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_RemoveUser (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";
   userId = "IDUser8@ldap";
   bGroupId = ESS_FALSE;
   bUserId = ESS_TRUE;
   sts = EssDeleteFromGroupEx (hCtx, groupId, bGroupId, userId, bUserId);
   printf("EssDeleteFromGroupEx 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