Edit Role dialog shows "No permissions assigned" on open when role has existing permissions #14

Closed
opened 2026-05-16 21:05:57 +00:00 by padreug · 0 comments
Owner

Summary

Opening the Edit Role dialog for a role that already has permissions assigned shows "No permissions assigned to this role yet" — the existing permissions only appear after a permission is added (or the dialog is closed and reopened after a refresh elsewhere).

Reproduction

  1. Pick a role that has at least one permission (e.g. Employee with Submit Expense on Expenses).
  2. Open Edit Role.
  3. Observe the empty "Role Permissions" section despite the role having permissions.
  4. Add a new permission via the + button — both the new permission and the previously hidden ones appear.

Likely Cause

The editRole(...) handler in static/js/permissions.js initializes the form fields (roleForm.name, description, is_default) but doesn't populate the role's permission list into the dialog's local state. The list state is only refreshed as a side effect of an add operation.

Suggested Fix

When opening Edit Role, call the same loader that the View Role dialog uses (loadRolePermissions(role.id) / rolePermissionsForView) so the existing permissions are visible immediately. Likely a few-line change in the open handler.

Severity

Cosmetic/UX — no data is lost, but the dialog is misleading and the user can't manage existing permissions without first triggering an add to reveal them.

## Summary Opening the Edit Role dialog for a role that already has permissions assigned shows "No permissions assigned to this role yet" — the existing permissions only appear after a permission is added (or the dialog is closed and reopened after a refresh elsewhere). ## Reproduction 1. Pick a role that has at least one permission (e.g. Employee with `Submit Expense` on Expenses). 2. Open Edit Role. 3. Observe the empty "Role Permissions" section despite the role having permissions. 4. Add a new permission via the `+` button — both the new permission *and* the previously hidden ones appear. ## Likely Cause The `editRole(...)` handler in `static/js/permissions.js` initializes the form fields (`roleForm.name`, `description`, `is_default`) but doesn't populate the role's permission list into the dialog's local state. The list state is only refreshed as a side effect of an add operation. ## Suggested Fix When opening Edit Role, call the same loader that the View Role dialog uses (`loadRolePermissions(role.id)` / `rolePermissionsForView`) so the existing permissions are visible immediately. Likely a few-line change in the open handler. ## Severity Cosmetic/UX — no data is lost, but the dialog is misleading and the user can't manage existing permissions without first triggering an add to reveal them.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/libra#14
No description provided.