Skip to content

feat(users): database user & privilege management (MySQL/MariaDB)#478

Open
pokertour wants to merge 3 commits into
TabularisDB:mainfrom
pokertour:feat/db-user-management
Open

feat(users): database user & privilege management (MySQL/MariaDB)#478
pokertour wants to merge 3 commits into
TabularisDB:mainfrom
pokertour:feat/db-user-management

Conversation

@pokertour

Copy link
Copy Markdown
Contributor

New "Users & Privileges" tab for drivers with the user_management capability:

  • list server accounts (locked flag, degraded fallback to CURRENT_USER when mysql.user is not readable)
  • create user with optional initial privileges on a chosen scope
  • change password, drop user (confirmed)
  • privilege editor: one card per scope (global / database / table) with checkboxes reflecting parsed SHOW GRANTS; checking grants, unchecking revokes (revoke-first so ALL PRIVILEGES -> subset works)
  • raw SHOW GRANTS output kept for grants the editor cannot model (roles, column-level, proxy)

Extensible by design: privilege catalog comes from the driver, all seven trait methods are forwarded over JSON-RPC so external plugins (e.g. MongoDB) can opt in via capabilities.userManagement; PostgreSQL support is planned as a follow-up. SQL builders validate privileges against per-scope allowlists and escape literals per the server sql_mode; builders and grant parser are unit-tested.

New "Users & Privileges" tab for drivers with the user_management
capability:

- list server accounts (locked flag, degraded fallback to CURRENT_USER
  when mysql.user is not readable)
- create user with optional initial privileges on a chosen scope
- change password, drop user (confirmed)
- privilege editor: one card per scope (global / database / table) with
  checkboxes reflecting parsed SHOW GRANTS; checking grants, unchecking
  revokes (revoke-first so ALL PRIVILEGES -> subset works)
- raw SHOW GRANTS output kept for grants the editor cannot model
  (roles, column-level, proxy)

Extensible by design: privilege catalog comes from the driver, all
seven trait methods are forwarded over JSON-RPC so external plugins
(e.g. MongoDB) can opt in via capabilities.userManagement; PostgreSQL
support is planned as a follow-up. SQL builders validate privileges
against per-scope allowlists and escape literals per the server
sql_mode; builders and grant parser are unit-tested.
Comment thread src-tauri/src/commands.rs Outdated
grant: bool,
) -> Result<(), String> {
log::info!(
"{} privileges for '{user}'@'{host}' on {}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: Log message omits table name for table-scope privilege changes

When database is Some("db") and table is Some("tbl"), the log currently prints "on db" instead of "on db.tbl", making audit logs ambiguous for table-level grants. Consider building a scope string that includes the table when present.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
src/utils/tabCleaner.ts 9 CleanedTab.type is missing the new 'users' value, causing a TypeScript type error when persisting users tabs

SUGGESTION

File Line Issue
src-tauri/src/commands.rs 4185 Log message for privilege changes omits the table name when applying table-level grants
Files Reviewed (17 files)
  • src-tauri/Cargo.lock
  • src-tauri/src/commands.rs - 1 issue
  • src-tauri/src/drivers/driver_trait.rs
  • src-tauri/src/drivers/mysql/mod.rs
  • src-tauri/src/drivers/mysql/users.rs
  • src-tauri/src/drivers/postgres/mod.rs
  • src-tauri/src/drivers/sqlite/mod.rs
  • src-tauri/src/lib.rs
  • src-tauri/src/models.rs
  • src-tauri/src/plugins/driver.rs
  • src/components/layout/ExplorerSidebar.tsx
  • src/components/users/UserManagementView.tsx
  • src/i18n/locales/en.json
  • src/i18n/locales/fr.json
  • src/pages/Editor.tsx
  • src/types/editor.ts
  • src/types/plugins.ts

Fix these issues in Kilo Cloud


Reviewed by kimi-k2.6 · Input: 162.8K · Output: 39.1K · Cached: 2.4M

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