Sample Code

The C SDK now lets you create users, assign them roles and associated privileges, and remove them from the system.

User-Management APIs

Users who have been assigned the Admin role for the cluster are able to create, edit, and remove users.
The C SDK provides APIs to support these activities.
A high-level summary of the APIs can be found in User-Management.

C User-Management Example

The following code-example demonstrates how the user-management APIs can be used.
It assumes that Couchbase Server is established on localhost; that the Full Administrator username and password are Administrator and password respectively; and that the travel-sample bucket is installed.
For information on installing the travel-sample bucket, see Sample Buckets.

Use of the Full Administrator username and password gives an application complete access to all resources within the Couchbase Server-environment: use of the Full Administrator username and password may therefore be useful during code-development.
However, for production purposes, the Full Administrator username and password should only be used when absolutely essential: in all other circumstances, the specified username and password should correspond to some lesser role, which appropriately delimits access to server-resources.
Creation of such a role, and the establishment of its associated username and password, is demonstrated in the following code-example.