Users and roles
- MongoDB
The users and roles editor shows a database’s users and custom roles. For the selected user you see its roles and the privileges they give; for a role, the roles it inherits and its privileges. Forms create and edit users and roles and show the commands they run as you fill them in. Passwords never appear in those commands.
Open the editor
Section titled “Open the editor”- Choose Users and roles from a database’s menu in the explorer.
- Choose Manage users or Manage roles on the Users or Roles folder.
- Double-click a user or a role.
Switch between the lists with Users and Roles. Show built-in roles adds the built-in roles to the Roles list.
| List | Columns | Details of the selected entry |
|---|---|---|
| Users | User, Roles, Mechanisms | Roles, Privileges (from its roles) and Custom data |
| Roles | Role, Inherits, Privileges | Inherits and Privileges; inherited entries are marked |
Create a user
Section titled “Create a user”- On the Users list, choose Create user….
- Enter the User name and Password.
- Tick the Mechanisms the user can sign in with (SCRAM-SHA-256 is ticked to start with).
- Under Roles, enter a role and its database for each role; Add role adds a row.
- Optionally add Custom data (optional) as a document.
- Check the command, which shows
passwordPrompt()in place of the password, choose Create…, then Run in the confirmation.
db.getSiblingDB('catalog').createUser({ user: 'reporting', pwd: passwordPrompt(), roles: [ { role: 'read', db: 'catalog' } ], mechanisms: [ 'SCRAM-SHA-256' ] })To change a user, select it and choose Edit…. New password (empty keeps it) leaves the password as it is when empty.
Create a role
Section titled “Create a role”- On the Roles list, choose Create role….
- Enter the Role name.
- Under Privileges, pick a resource for each privilege (Database, Collection,
Cluster or Any resource) and its actions, such as
find, collStats. Add privilege adds a row. - Under Inherited roles, add the roles this one includes.
- Check the
createRolecommand, choose Create…, then Run.
Built-in roles cannot be edited or dropped.
Drop a user or role
Section titled “Drop a user or role”Select it and choose Drop…. The confirmation shows the dropUser or dropRole command; choose
Drop to run it.
Related
Section titled “Related”Documents Querybara 0.1.1 · built frombc9f5aa