[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing the semantics of admin__get_roles and admin__get_roles_for_user


Working on https://sourceforge.net/p/ledger-smb/bugs/1395/ (Unable to remove role from user), I'm running into the (old) problem that all postgresql roles are considered relevant. What I mean by that is that LedgerSMB creates roles prefixed with "lsmb_<company>__" (or an alternative specified in the defaults table), but roles which don't match that prefix are considered possibly relevant (because they could have been created by users/admins).

I'd like to propose to change that rule to:

"We define a namespace (lsmb_<company>__) and manage that namespace. Anything outside that namespace *can* be created outside of the realm of the application, so it's not the responsibility of the application to manage it."

What I mean by that is that the functions 'admin__get_roles" and "admin__get_roles_for_user" return only the PostgreSQL roles which are in the namespace *we* manage for the *current* company.

If I change the above two functions to do exactly that, I know how to fix the issue. I'll submit a PR based on this change, even though it'll be in the middle of a 1.4 series...

Long term, I'd like all role references to be prefix-relative.



http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
Ledger-smb-devel mailing list