Skip to content

metadata(oracle), dialect: users and roles with plain read rights, a user granted like a role - #106

Merged
stbischof merged 2 commits into
eclipse-daanse:mainfrom
stbischof:feat/users-and-roles
Dec 1, 2026
Merged

stbischof merged 2 commits into
eclipse-daanse:mainfrom
stbischof:feat/users-and-roles

Conversation

@stbischof

Copy link
Copy Markdown
Contributor

The Oracle metadata reads users from ALL_USERS, which every user may read, and roles and memberships from USER_ROLE_PRIVS and ROLE_ROLE_PRIVS: the roles the reading user holds, also through other roles, and the memberships among them. No DBA_ view is read, so a reader without elevated rights no longer gets an empty list of principals or only its own memberships.

DdlGenerator.supportsUserAsRole() says whether grantRole may name a user where it names a role. PostgreSQL grants a user like any role, a user being a role that may log in; MySQL from 8.0 does too, users and roles being accounts alike. MariaDB grants roles made with CREATE ROLE only, as do the other dialects.

Tested in Docker:

  • Oracle Free 23: the metadata contract; a user with plain read rights reads every user, the roles it holds, also one through another role, and the memberships among them
  • PostgreSQL 12 and 16, MySQL 5.7, 8.0, 8.4 and 9: a user granted like a role, the grantee holds the user's privileges
  • MariaDB 10.6 and 11.4: a user named where a role stands is refused
  • every dialect: supportsUserAsRole in the consistency tests

…user granted like a role

The Oracle metadata reads users from ALL_USERS, which every user may
read, and roles and memberships from USER_ROLE_PRIVS and ROLE_ROLE_PRIVS:
the roles the user holds, also through other roles, and the memberships
among them. No DBA_ view is read, so a reader without elevated rights no
longer gets an empty list of principals or only its own memberships.

DdlGenerator.supportsUserAsRole says whether grantRole may name a user
where it names a role. PostgreSQL grants a user like any role, a user
being a role that may log in; MySQL from 8.0 does too, users and roles
being accounts alike. MariaDB grants roles made with CREATE ROLE only,
as do the other databases. Tested in Docker on Oracle 23, PostgreSQL 12
and 16 and MySQL 5.7 to 9.

Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
MariaDB refuses a user where GRANT names a role and grants a role made
with CREATE ROLE, as supportsUserAsRole says; tested on MariaDB 10.6
and 11.4.

Signed-off-by: Stefan Bischof <stbischof@bipolis.org>
@stbischof
stbischof merged commit ffa42ec into eclipse-daanse:main Dec 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant