Documentation

Role-Based Access Control (RBAC)

Access Control

Manage MongoDB users, roles, permissions, and teams from a single dashboard. Create database users with SCRAM, X.509, or external authentication, define custom roles with granular privileges, scope permissions to individual databases, organize users into groups, and audit every administrative action.

Access Control covers the following capabilities:

  • MongoDB user management — create, edit, enable/disable, and delete users; assign roles at create time or later
  • Built-in role browsing and custom role definitions with granular privileges on cluster, database, and collection resources
  • Database-level permission scoping so a single user can hold different roles in different databases
  • Group management for teams — grant a bundle of roles to many users at once
  • Effective-privilege calculation across every role, inherited role, and group membership
  • Audit log of every RBAC action with CSV export for compliance reviews
  • Session monitoring for active connections
  • Connection-level read-only mode from the Connection Manager as a client-side safety net

Note: Admin access to the admin database is required for full RBAC management. Without admin privileges, you'll have limited functionality — the dashboard falls back to read-only views of the users and roles the current session can see.

RBAC Dashboard overview with statistics cards and recent activity

Dashboard Overview

The Dashboard tab provides a high-level view of your MongoDB security configuration.

Statistics Cards

  • Total Users - Count of all database users
  • Active Users - Non-disabled user accounts
  • Total Roles - Built-in and custom roles combined
  • Custom Roles - User-defined custom roles
  • Total Databases - Databases in the deployment
  • Active Sessions - Currently active user connections

Quick Actions

  • Create User - Opens the create user form
  • Create Role - Opens the custom role creation form
  • View All Users - Navigate to Users tab
  • View Roles - Navigate to Roles tab
  • Refresh - Reload dashboard statistics

Users Tab

The Users tab provides comprehensive user management with filtering, search, and bulk operations.

Users tab with search, filters, and user list table

User List Features

  • Search - Search by username, principal, or auth database
  • Type Filter - Filter by SCRAM, X.509, or External auth
  • Role Filter - Filter users by assigned role
  • Database Filter - Filter by authentication database
  • Bulk Selection - Select multiple users for bulk operations

User Display Columns

ColumnDescription
PrincipalUsername@authDB for SCRAM, DN for X.509, or principal for External
TypeAuthentication type badge (SCRAM, X509, EXTERNAL)
RolesAssigned roles in role@database format
StatusActive or Disabled indicator
ActionsView, Enable/Disable, Delete buttons

Creating Users

Create User modal showing authentication type selection and form fields

SCRAM Authentication (Default)

FieldDescriptionRequired
UsernameUnique username for database authenticationYes
PasswordUser password (masked with show/hide toggle)Yes
Auth DatabaseDatabase where credentials are stored (typically 'admin')Yes
RolesAssign roles with database scope (e.g., readWrite@mydb)At least one

X.509 Certificate Authentication

FieldDescriptionRequired
Distinguished NameFull X.509 certificate subject DNYes
RolesAssign roles with database scopeAt least one

External Authentication (LDAP, Kerberos, AWS IAM)

FieldDescriptionRequired
PrincipalExternal principal identifier (LDAP DN, Kerberos principal, AWS ARN)Yes
MechanismAuthentication mechanism (LDAP, GSSAPI, MONGODB-AWS)Yes
RolesAssign roles with database scopeAt least one

User Detail View

User Detail modal showing Overview, Roles, Effective Privileges, and Sessions tabs
  • Overview Tab - Principal, auth type, roles, status, timestamps
  • Roles Tab - Manage assigned roles (grant/revoke)
  • Effective Privileges Tab - Computed permissions from all roles
  • Sessions Tab - Active sessions with client IP and connection time

Roles Tab

Manage built-in MongoDB roles and create custom roles for specific security requirements.

Roles tab with search, scope filter, and role list table

Built-in Database Roles

RoleDescription
readRead-only access to all non-system collections
readWriteRead and write access to all non-system collections
dbAdminDatabase administration (create collections, indexes)
dbOwnerFull database admin (readWrite + dbAdmin + userAdmin)
userAdminCreate and manage users and roles

Built-in Cluster Roles

RoleDescription
clusterAdminFull cluster administration access
clusterMonitorRead-only monitoring access
backupBackup operations
restoreRestore from backups
rootSuperuser with all privileges

Creating Custom Roles

Create Role modal with name, database, privileges, and inherited roles

Role Configuration

FieldDescriptionRequired
Role NameUnique name for the custom roleYes
DatabaseDatabase where the role is definedYes
DescriptionHuman-readable description of the roleNo
PrivilegesSpecific actions on resourcesAt least one
Inherited RolesOther roles this role inherits fromNo

Privilege Resource Types

  • Cluster - Cluster-wide administrative actions
  • Database - Database-level operations (createCollection, dropDatabase)
  • Collection - Collection-level operations (find, insert, update, remove)
  • Any Resource - Grants privilege on all databases/collections

Common Collection Actions

ActionDescription
findQuery documents
insertInsert new documents
updateModify existing documents
removeDelete documents
createIndexCreate indexes
dropIndexRemove indexes

Database-Level Permission Scoping

Every MongoDB role assignment is scoped to a specific database. A user can hold different roles in different databases, which is the primary way you grant least-privilege access in MongoDB.

In VisuaLeaf, the role picker on both the Create User and User Detail views uses the role@database format:

  • read@reporting — read-only access to the reporting database
  • readWrite@orders — full document access to the orders database only
  • dbAdmin@analytics — administer indexes and collections in analytics, with no data access anywhere else
  • read@admin paired with readWrite@app — a common pattern for users that need to inspect server-level metadata but only write to a single application database

Scoping Workflow

  1. Open the Users tab and click Create User (or edit an existing user)
  2. Enter the Username and select the Auth Database (typically admin)
  3. In the Roles field, start typing a role name and pick a built-in or custom role
  4. Choose the target database from the second dropdown — this is what limits the grant
  5. Repeat to add additional role@database grants; each row is an independent scope
  6. Use the Effective Privileges tab on the user detail view to verify the resolved permissions per database

Tip: Grants against the special anyResource or cluster resource cannot be limited to a single database — if you see those in the Effective Privileges panel, review which role introduced them.

Effective Privileges

View the complete set of permissions a user or role has, including inherited privileges and group grants.

Effective Privileges panel with hierarchical resource tree
  • Privilege Aggregation - Computes all privileges from direct roles, inherited roles, and group memberships
  • Resource Grouping - Organizes by resource type (cluster, database, collection)
  • Inheritance Chain - Shows which role or group granted each privilege
  • Per-Database View - Filter the tree to a single database to confirm the scope of granted privileges

Groups and Teams

Groups let you bundle a set of roles and assign that bundle to many users at once. They are ideal for teams (e.g., "Data Analysts", "Support Engineers", "SREs") where every member should hold the same set of grants.

Creating a Group

  1. Open the Groups tab from the Access Control dashboard
  2. Click Create Group and enter a name and optional description
  3. Add one or more role@database grants — these apply to every member
  4. Save the group, then add users from the Members panel or from an individual user's detail view

Managing Membership

  • Add or remove members from the group's Members panel
  • Group membership shows up in the user's Effective Privileges with the group name as the inheritance source
  • Removing a role from a group revokes it from every member simultaneously — audit the impacted user list before saving

Audit Log

Every RBAC action performed through VisuaLeaf is recorded in the audit log so you can trace who did what, when, and against which target. The log is stored server-side and survives client restarts.

Audit Log Contents

FieldDescription
TimestampUTC timestamp of the action (millisecond precision)
ActorThe VisuaLeaf user and MongoDB principal that initiated the action
Actione.g., user.create, user.grant-role, role.update, group.add-member, user.disable
TargetThe user, role, group, or database the action applied to
DetailsBefore/after snapshot of the change (roles added, privileges revoked, etc.)
Client IPSource IP of the actor's session
ResultSuccess or failure, with the server error message if applicable

Filtering the Audit Log

  • Date range — pick a preset (last hour, last 24h, last 7 days) or a custom range
  • Actor — narrow to a single VisuaLeaf user or MongoDB principal
  • Action — multi-select action types (create/update/delete/grant/revoke/disable/enable)
  • Target — search by user, role, or group name
  • Result — show only successes, only failures, or both

Exporting to CSV

The audit log can be exported to CSV for compliance reviews, ticket attachments, or downstream SIEM ingestion.

  1. Open the Audit Log tab
  2. Apply the filters you want the export to include (date range, actor, action, etc.) — the export honors the current filter set
  3. Click the Export CSV button in the toolbar
  4. Choose whether to include the "Details" column — unchecked produces a compact log, checked produces a full change-record export
  5. Confirm the file name and destination when the browser download prompt appears

The exported file uses UTF-8 with a BOM (so Excel opens it cleanly), comma delimiters, and RFC 4180 quoting. Each row corresponds to a single audit event; multi-value fields (e.g., "roles added") are JSON-encoded inside their cell so the CSV stays flat.

Tip: Schedule a monthly export against a fixed date range and archive the CSVs alongside your access-review artifacts — this is usually enough evidence to satisfy SOC 2, ISO 27001, and PCI DSS access-review controls.

Session Monitoring

Monitor active user sessions to track database connections.

Sessions tab showing active connections with session details

Session Information

FieldDescription
Session IDUnique identifier for the connection
Client IPSource IP address
Connection TimeWhen the session started
Last ActiveTimestamp of last operation
Client AppDriver or application name

Tips

  • Least Privilege - Grant only minimum permissions needed for tasks, and prefer database-scoped grants (role@database) over cluster-wide roles
  • Use Built-in Roles First - Create custom roles only when the built-in ones do not fit
  • Role Composition - Build complex roles by inheriting from simpler ones instead of duplicating privileges
  • Group by Team - Manage team access through groups so joiners/leavers can be handled in one place
  • Regular Audits - Export the audit log to CSV monthly and reconcile against your HR system for departed users
  • Belt and Braces - Combine a MongoDB user that only holds read with a Connection Manager read-only toggle to prevent accidental writes from the UI
  • Disable vs Delete - Disable accounts temporarily instead of deleting so their audit trail stays linked
  • Connection Manager - Configure SSL/TLS for X.509, LDAP, Kerberos, AWS IAM, and OIDC authentication, and toggle client-side read-only mode
  • Query Monitor - See what queries users are running in real time
  • Database Statistics - Monitor resource usage by users and databases

Ready to try VisuaLeaf?

Download and start managing your MongoDB databases with ease.

Download Free Trial