Permission dropdown allows mismatched account-type / permission-type combinations #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
In both the "Grant Account Permission" (user-level) and "Add Permission to Role" (role-level) dialogs, the Permission Type dropdown offers every type regardless of the selected account's type. The backend silently accepts the grant, but the entry-submission endpoints never honor it — leading to confusing 403s.
Concrete cases:
Submit Expenseon a Revenue account (e.g.Income:Accommodation:Guests) — useless:/entries/expensechecks against an expense account, never against this one.Submit Incomeon an Expense account — useless:/entries/incomerequires the account to beAccountType.REVENUE.This came up while wiring up #9 — an existing role had
Submit Expensegranted on an Income account, the admin assumed it would cover income submission, and the user got a 403 with no obvious diagnostic.Proposed Fix
In
static/js/permissions.js/templates/libra/permissions.html, filter the Permission Type options based on the currently selected account'saccount_type:Read,Manageonly.Read,Submit Expense,Manage.Read,Submit Income,Manage.The filter should reactively update when the account selection changes, and should reset the
permission_typefield if the current selection becomes invalid for the new account.Severity
UX / footgun. No data corruption, but actively misleading for admins setting up role-based access and a frequent cause of the user-visible "you do not have permission..." 403.