Skip to content

Creating and Managing Groups

Users in the na-user system can be placed in arbitrary groups. This is done by creating a group and adding users to the group. Subsequently the system can be queried to find out if the user is a member of the group.

This is a very simple group system allowing business logic maximum flexibility in defining a group and who may be a part of it. The na-user system makes no assumptions about the meaning of any group. This is expected to be handled by the business logic which uses the API.

The Group Object

The group object is a small set of fields which identifies a group.

The API presents the group object as a JSON entry with the following structure:

{
  "create_time": "2017-08-19T13:43:44Z",
  "description": "Group 100",
  "gid": "2c1ac8d338d8198f7d02dc568efcb86e",
  "name": "group100",
  "update_time": "2017-08-19T13:43:44Z"
}

Below is a description of each group field and its type.

Field Name Field Type Max Length Notes
gid string 36 unique random group identifier, if not provided it is autogenerated
name string 80 unique group name
description string 191 group description string
update_time string 30 RFC 3339 time-date format. Example: 2017-04-05T15:18:27Z
create_time string 30 RFC 3339 time-date format. Example: 2017-04-05T15:18:27Z

Note that the timestamp fields create_time and update_time are system generated and can not be manipulated via the API.

Working With the Group Object

The na-user service has the following self explanatory API calls for manipulating the group object. See the The Group Object section of the na-user API Reference for full syntax and important notes about using these calls:

API Call API Endpoint
Create group POST /groups/create
Get Group GET /groups/get/{uid}
Update Group POST /groups/update/{uid}
Exists Group GET /groups/exists/{uid}
Delete Group DELETE /groups/delete/{uid}
List Groups GET /groups/list
Search Groups POST /groups/search
Add User to Group PUT /groups/adduser/{gid}/{uid}/
Delete User from Group DELETE /groups/deluser/{gid}/{uid}
List Members by Group gid GET /groups/members/gid/{gid}
List Members by Group name GET /groups/members/groupname/{name}

Many of the API calls have parameters which shape the returned responses.

For example the List Members by Group gid API calls can limit the set of returned fields, their sort order, and the paging size.