Skip to content

feat(auth): inherit tenant_users.role for paired sessions#1066

Open
imcvampire wants to merge 1 commit intonextlevelbuilder:devfrom
imcvampire:dev
Open

feat(auth): inherit tenant_users.role for paired sessions#1066
imcvampire wants to merge 1 commit intonextlevelbuilder:devfrom
imcvampire:dev

Conversation

@imcvampire
Copy link
Copy Markdown

@imcvampire imcvampire commented Apr 29, 2026

Both WS pairing (router.go) and HTTP X-GoClaw-Sender-Id auth were pinned to RoleOperator. Now they map tenant_users.role -> permissions.Role (owner/admin/operator|member/viewer) so a tenant admin who logs in via pairing actually gets admin in the dashboard. Falls back to RoleOperator when the user has no membership row (backward compatible). Tenant is inferred from a single membership when no hint is provided.

Summary

Type

  • Feature
  • Bug fix
  • Hotfix (targeting main)
  • Refactor
  • Docs
  • CI/CD

Target Branch

Checklist

  • go build ./... passes
  • go build -tags sqliteonly ./... passes (if Go changes)
  • go vet ./... passes
  • Tests pass: go test -race ./...
  • Web UI builds: cd ui/web && pnpm build (if UI changes)
  • No hardcoded secrets or credentials
  • SQL queries use parameterized $1, $2 (no string concat)
  • New user-facing strings added to all 3 locales (en/vi/zh)
  • Migration version bumped in internal/upgrade/version.go (if new migration)

Test Plan

@imcvampire imcvampire marked this pull request as ready for review April 29, 2026 08:41
Both WS pairing (router.go Path 3a) and HTTP X-GoClaw-Sender-Id auth
were pinned to RoleOperator. Now they map tenant_users.role ->
permissions.Role (owner/admin/operator|member/viewer) so a tenant admin
who logs in via pairing actually gets admin in the dashboard. Falls
back to RoleOperator when the user has no membership row (backward
compatible). Tenant is inferred from a single membership when no hint
is provided.

Signed-off-by: imcvampire <anhnq0@gmail.com>
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