CYBORGDB_SERVICE_ROOT_KEY set, EncryptedIndex can create, list, and revoke per-index users. These methods require a client created with the root key.
See Multi-Tenancy & RBAC for the operator-side playbook (modes, key kinds, SDK-supplied indexes).
create_user
Creates a user scoped to this index and returns their API key.Parameters
Returns
Dict[str, str]:
Example
list_users
Lists the users created for this index.Returns
A list of dicts:Example
Deleting an index doesn’t delete its user records. If you create a new index with the same name,
list_users() on it still returns the old users. They can’t read the new index, because their keys don’t unwrap its data key; delete them with delete_user().delete_user
Revokes a user. Their access keys for this index are erased, so theircdbk_ key stops working on the next request.
Parameters
Example
Exceptions
These apply to all three methods:cyborgdb.AuthenticationError
cyborgdb.AuthenticationError
The client isn’t using the root key (HTTP
403), or its api_key is invalid (HTTP 401).cyborgdb.ValidationError
cyborgdb.ValidationError
permissions is empty or contains a value other than "read" or "write", or user_id isn’t hex (HTTP 400).cyborgdb.NotFoundError
cyborgdb.NotFoundError
The index doesn’t exist (HTTP
404).cyborgdb.ServiceError / cyborgdb.TransportError
cyborgdb.ServiceError / cyborgdb.TransportError
The service returns
5xx or can’t be reached.