Conversation
Before Openfga we were relying on the `is_superuser` field of the User model. When we introduced Openfga, we added a Django signal which automatically assigns the openfga group on the user creation based on the `is_superuser` property. However, with candid/rbac that property is only populated AFTER user creation, resulting in all the users belonging to the "Users" group. This commit enables the possibility to re-evaluate the group membership every time the user gets re-validated through Candid or RBAC. This only works with the two default groups that we have (i.e. Users and Administrators).
There was a problem hiding this comment.
[maas-code-reviewer review]
LLM-generated review from https://github.com/canonical/maas-code-reviewer.
Intended to assist a human reviewer, not replace one — suggestions may be
incorrect, please verify before acting.
The PR correctly aims to keep OpenFGA group memberships in sync when a user's Candid or RBAC permissions are re-evaluated. However, there is a critical bug where the newly added async function is called directly from synchronous code in the legacy authentication backend, preventing it from executing.
Please see the inline comments for details on how to fix this.
|
QA steps:
With this patch:
Setting up candid/rbac can be tedious, shameless plug for https://github.com/alemar99/maas-dev-scripts : # Checkout this branch in the MAAS repo
git remote add alemar99 ...
git checkout alemar99/fix-candid-rbac-openfga-groups
# In the maas-dev-scripts repo run:
./maas-env.py create snap rbac-38 --channel=3.8/candidate --post /scripts/rbac_setup.sh:all
# Follow manual instructions for rbac
./maas-env.py shell rbac-38
# Execute commands as per the instructions, then
./maas-env.py sync rbac-38 <path_to_your_maas_repo>
./maas-env.py overlay apply rbac-38 |
r00ta
left a comment
There was a problem hiding this comment.
if MAAS is using RBAC, we should not have any component that relies on openfga/rebac. The UI should not consult the entitlements in order to show what a user can/can't do. If a user comes from candid, it should land into the base group
|
Summary from the meet we had with @r00ta :
|
Before Openfga we were relying on the
is_superuserfield of the User model. When we introduced Openfga, we added a Django signal which automatically assigns the openfga group on the user creation based on theis_superuserproperty. However, with candid/rbac that property is only populated AFTER user creation, resulting in all the users belonging to the "Users" group. This commit enables the possibility to re-evaluate the group membership every time the user gets re-validated through Candid or RBAC. This only works with the two default groups that we have (i.e. Users and Administrators).