.NET

Roles and Permissions

The Permissions section is a role and privilege browser for PostgreSQL. It lays a server's roles out Finder-style, in side-by-side columns: pick a role on the left, and the columns to its right show who it is a member of, who is a member of it, and what it can actually do on every database object — including everything it only has indirectly, through inherited role memberships or through PUBLIC. Roles, memberships, privileges, default privileges and ownership can be created, changed and revoked right there.

Note: this section currently supports PostgreSQL only. For any other connection it shows Permissions are not yet supported for … / Currently only PostgreSQL is supported.

The Permissions section with three columns

Opening the section

Click the Permissions icon (the people icon) in the left rail. The section works on a connection that is already open in the Database section: the same strip of open connection tabs is shown at its top, and the section uses whichever connection tab is selected there. With no connection open it shows No connection open — open one first (see Managing Databases). The columns are rebuilt every time you enter the section, so any earlier selection is reset.

Everything you do here needs the same privileges the equivalent SQL would need (CREATEROLE, superuser, or ownership of the object, depending on the action) — OmniDB runs the statements with the credentials of the connection you are using. The three columns can be resized by dragging the thin handle on their right edge; a double-click on a handle resets that column, and the widths are remembered.

Column 1: Roles

The Roles column lists every role on the server, including the built-in pg_* roles, sorted by name. Roles that can log in (users) have a single-person icon; roles that cannot (groups) have a two-person icon; superusers are marked (superuser) and roles whose account has expired (expired). The first row is always PUBLIC (globe icon) — not a real role, but the pseudo-role every role implicitly belongs to, so that privileges granted to PUBLIC can be browsed and edited the same way.

The box above the list filters roles by name, and the drop-down next to it by kind: All roles, Users (can log in), Groups (no login), Superusers or Expired.

Click a role to focus it; the other columns then show that role. Below the list:

The Create Role dialog with the SQL preview

Right-clicking a role (not PUBLIC) offers:

The context menu of a role

Column 2: memberships

The second column is split in two halves:

In both halves, direct memberships are shown in normal text and indirect (inherited) ones in italics with a faded icon. A direct membership granted WITH ADMIN OPTION is marked (admin option); on PostgreSQL 16 and later, (no inherit) and (no SET) mark memberships that lack the INHERIT or SET option.

Column 3: objects and effective privileges

The third column, … — Objects, is a tree of everything the focused role has any privilege on — its effective privileges: its own direct grants plus everything it inherits through its memberships and through PUBLIC. It starts with two groups, Databases (every database on the server) and Tablespaces; a node is shown normally if the role has some privilege there, and greyed out otherwise. The box at the top filters databases and tablespaces by name and keeps its text when you switch roles.

Expanding a database loads its objects over a separate connection to that database (the connection tab's own active database does not change): Schemas, and inside each schema folders for Tables, Views, Sequences, Functions, Procedures, Materialized Views, Types and Domains; foreign data wrappers and foreign servers sit directly under the database. Only objects the role actually has a privilege on are listed (system schemas are left out); a schema shown greyed out is there only because something inside it is. Every database also has two extra folders: Owned objects (n), listing what the role owns there (up to 1000 entries), and Default privileges, described below. If there is nothing at all, the database shows No privileges on any object in this database.

The Objects column expanded down to the tables

Editing privileges

Right-click a database, tablespace, schema or object and choose Edit Privileges. The dialog lists every privilege valid for that kind of object as a checkbox:

The checkboxes show what the role holds directly:

The Edit Privileges dialog with the SQL preview

With grant option applies to the privileges you newly grant in that dialog. Confirm with Save.

To grant something on an object that is not in the tree yet, use the + (Add Object Privilege) under the column: choose the Object Type, then the Database (for everything except databases and tablespaces; it defaults to the connection's current database), the Schema for schema-level objects, the Object itself (functions are shown with their argument signature), tick the Privileges and, optionally, With grant option. For tables, sequences, functions and procedures the Scope choice can be switched from Selected object to All … in the schema, with Grant or Revoke: OmniDB then runs GRANT/REVOKE … ON ALL … IN SCHEMA, which affects the objects that exist now, not those created later.

Selecting PUBLIC in the first column lets you edit what is granted to PUBLIC itself (GRANT … TO PUBLIC / REVOKE … FROM PUBLIC).

Default privileges

The Default privileges folder of a database lists the ALTER DEFAULT PRIVILEGES entries that involve the focused role, either as the grantee or as the creating role. They are the way to cover objects created in the future. Right-click the folder for Add Default Privileges: choose the creating role (For objects created by), the schema (or all schemas), the object kind (tables, sequences, functions, types, schemas) and the privileges. Right-click an existing entry for Edit Privileges (only the ticks you change are granted or revoked) or Remove Default Privileges.

Ownership and who has access

The Who Has Access dialog

Previewing the SQL

The dialogs for creating, altering, renaming and cloning roles, adding memberships, granting or editing privileges, default privileges and changing owners have a collapsible Show SQL box. It shows the exact statements the current form values would run — built by the same server code as the real call, nothing is executed, passwords are masked — and keeps them up to date as the form changes. Copy SQL copies them.

Important: confirming a dialog executes the statements on the server immediately — there is no undo. Review them with Show SQL first. Drop Role, Remove Membership and Remove Default Privileges also ask for confirmation. If the server rejects a statement, its error message is shown.