5.16. GET /db/_security

MethodGET /db/_security
Request None
Response JSON of the security object
Admin Privileges Requiredno

Gets the current secrity object from the specified database. The security object consists of two compulsory elements, admins and readers, which are used to specify the list of users and/or roles that have admin and reader rights to the database respectively. Any additional fields in the security object are optional. The entire security object is made available to validation and other internal functions so that the database can control and limit functionality.

To get the existing security object you would send the following request:

{
   "admins" : {
      "roles" : [],
      "names" : [
         "mc",
         "slp"
      ]
   },
   "readers" : {
      "roles" : [],
      "names" : [
         "tim",
         "brian"
      ]
   }
}

Table 5.8.  Security Object

FieldDescription
admins Roles/Users with admin privileges
        roles [array] List of roles with parent privilege
        users [array] List of users with parent privilege
readers Roles/Users with reader privileges
        roles [array] List of roles with parent privilege
        users [array] List of users with parent privilege

Note

If the security object for a database has never beent set, then the value returned will be empty.