Skip to content

feat(users-roles): manage SQL Server and Oracle users, roles and privileges - #3733

Merged
datlechin merged 3 commits into
mainfrom
feat/3610-users-roles-mssql-oracle
Oct 21, 2026
Merged

datlechin merged 3 commits into
mainfrom
feat/3610-users-roles-mssql-oracle

Conversation

@datlechin

@datlechin datlechin commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • SQL Server and Oracle conform to PluginPrincipalManagement and declare .userManagement: Database > Users & Roles opens on both.
  • SQL Server lists logins, server roles, and the current database's roles and users. A login carries the user sharing its SID (sa is dbo). Permissions at server, database, schema, object and column scope; the catalog is sys.fn_builtin_permissions.
  • SQL Server statements: CREATE LOGIN + CREATE USER FOR LOGIN, CREATE ROLE, ALTER LOGIN ENABLE/DISABLE, ALTER ROLE / ALTER SERVER ROLE ... ADD/DROP MEMBER, passwords, drops, all in one transaction. Server permissions run in master, database statements in the database the list was read from, both through EXEC [db].sys.sp_executesql, so the session never switches database. A login with no user there gets one first (SID checked).
  • Oracle: DBA_USERS / DBA_ROLES / DBA_*_PRIVS, falling back to the ALL_, USER_ and ROLE_ views on ORA-00942. System privileges at server scope, object privileges on tables and views, column INSERT/UPDATE/REFERENCES, ADMIN and GRANT option kept. Create, lock, unlock, drop, password, role grants.
  • SQL and row parsing live in TableProMSSQLCore and TableProOracleCore; the plugins only map PluginKit types.
  • App: curated supportsRoleLogin (false for both, kept through plugin registration). Can log in is off for roles and staged creates there; the connection limit is hidden.
  • An apply on an engine that cannot roll principal statements back (MySQL, Oracle) is refused while the session holds a transaction: their DDL would commit it first. Before this, MySQL committed the user's pending work silently.
  • Every ] and " doubling in the MSSQL plugin and OracleSchemaQueries matches by code unit. A grapheme match skipped a quote followed by a combining mark and ended the identifier early.

Not in this PR

  • Default database and schema (SQL Server), default tablespace and quota (Oracle): string-valued principal settings need a PluginKit transfer field and a form section.
  • SQL Server DENY, column REVOKE exceptions under a table grant (state = 'R'), permissions a fixed role implies, EXECUTE on modules, Windows logins and contained users from the sheet.
  • Oracle DROP USER ... CASCADE: the drop sheet offers reassign or drop-owned, which fits PostgreSQL only. Oracle revokes an object privilege only for its grantor (ORA-01927); the list does not show the grantor.
  • The checklist offers server permissions to a SQL Server database role and the reverse; review refuses the change as unsupported. A per-principal catalog needs PluginKit.
  • Users & Roles does not reload when the connection switches database (every engine).
  • PluginKit's default quoteIdentifier doubles " by grapheme cluster too.

Test plan

  • TableProMSSQLCoreTests (105 run): directory merge and collisions, statements per kind, database scoping and sp_executesql quoting, escaping, row parsing, catalog split.
  • TableProOracleCoreTests (292 run): DBA and session queries, 11g vs 12c+ columns, statements, column revoke refusal, code-unit quoting.
  • UsersRolesLoginToggleTests, PrincipalApplyOpenTransactionTests plus the existing Users & Roles suites (44 run).
  • MSSQLDriver and OracleDriver schemes build.
  • Live, through the new probes, from a session sitting in another database: apple/scripts/probes/check-mssql-principals.sh on SQL Server 2022 CU14 (15 checks: one-transaction apply, Msg 4621 outside master, CREATE LOGIN rollback, read-back, revoke, drop) and apple/scripts/probes/check-oracle-principals.sh on Oracle Free 23ai (26 checks: create, grant, lock, read-back, ORA-00942 fallback, ORA-01750, revoke, password, drop). Not run on 2019 or 19c: no image on the build machine.

Fixes #3610

@datlechin
datlechin enabled auto-merge (squash) October 21, 2026 01:10
@datlechin
datlechin merged commit c4cae24 into main Oct 21, 2026
8 of 9 checks passed
@datlechin
datlechin deleted the feat/3610-users-roles-mssql-oracle branch October 21, 2026 03:59
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.

Users & Roles for SQL Server and Oracle

1 participant