-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(rbac): add ownership conditional rule to backend plugin #3265
base: main
Are you sure you want to change the base?
Conversation
Changed Packages
|
ba72894
to
d740702
Compare
Thank you, Patrick. I have 2 questions:
|
|
workspaces/rbac/plugins/rbac-backend/src/database/role-metadata.ts
Outdated
Show resolved
Hide resolved
fd86f6c
to
de5f9c9
Compare
workspaces/rbac/plugins/rbac-backend/src/database/role-metadata.ts
Outdated
Show resolved
Hide resolved
de5f9c9
to
49ecc23
Compare
workspaces/rbac/plugins/rbac/src/components/CreateRole/PermissionPoliciesFormNestedRow.tsx
Outdated
Show resolved
Hide resolved
workspaces/rbac/plugins/rbac/src/components/CreateRole/RoleDetailsForm.tsx
Outdated
Show resolved
Hide resolved
workspaces/rbac/plugins/rbac/src/components/RolesList/DeleteRole.tsx
Outdated
Show resolved
Hide resolved
49ecc23
to
a630493
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backend looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PatAKnight
Should we provide edit
icon on role details
page in About
section , since some user will like to edit owner
, currently if they wish to do so , the need to click edit
icon in Users and groups
and they will need to click back . Or is it finr for now .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not able to edit owner
attaching screen recording for the same .
RBAC-owner-edit-1.mov
That's a good idea! |
a630493
to
aa8de92
Compare
@its-mitesh-kumar I think that it should be fine for now and we can create a follow up task for this. Users are still able to make the edit from the RBAC page as well. So, at least there are a couple of avenues that they can take. Sorry, just trying to keep the scope down as much as possible
@its-mitesh-kumar, thanks for the catch! Looks like I missed the assignment in the backend. Should be fixed now.
@ShiranHi, looks like there was actually a bug with this. It is fixed now and will display |
47a9f6b
to
1f4ca47
Compare
Tested this after a rebase. Everything works correctly except 1 issue, great work @PatAKnight! I tested this with yaml and csv permissions. Not sure if these are in scope? But for on startup creation, I get this error:
Probably because this is on startup and the endpoint is not there yet. I tested with:
When I later updated the yaml or csv file, permissions were correctly created and applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PatAKnight I am able to see the role created by admin for the team lead in team leads account and its editable. IMO role created for team lead by admin should not be visible to the lead.
lead.able.to.see.adminrole.mp4
Also I am able to create role from lead account without adding the owner and the roles gets created but is not visible to the lead. The role created by the lead irrespective of if they added themselves as owner or not should be visible otherwise its not a good user experience as they can create the role but not see it.
Screen.Recording.2025-03-28.at.4.56.17.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PatAKnight Instead of No owner
can we just show -
as this is what we showed previously for all other fields?

Here also instaed of leaving owner empty can we show -
so that it is clear that the owner is not added here.

@divyanshiGupta this was because you assigned the team lead to be the owner of that role. If you were to remove them from ownership and instead leave it blank or assign the admin as the owner, then they would not be able to see it.
The conditional rule acts as a filter based on what the rule is targeting, in this case the owner field of the role. If it is not set, then the role will be filtered out by the condition. This is similar behavior for all conditional rules within Backstage. An example would be if you have
So, I mentioned above that there was actually a bug related to this and we are suppose to be showing 'No description' and 'No information' for the fields that are not set. I can change the owner field to display '-', if we are fine with it being different from the other fields.
Yes, I can update the review section |
@divyanshiGupta forgot to ask, but would you like for me to do the same with the description as well? |
workspaces/rbac/plugins/rbac-backend/src/service/policies-rest-api.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
Signed-off-by: Patrick <[email protected]>
9f5f783
to
63c5488
Compare
Signed-off-by: Patrick <[email protected]>
@PatAKnight , @divyanshiGupta it is better to use a double dash (--) when you want to indicate "no value" more explicitly. |
@ShiranHi, I am fine with swapping 'No owner' to '--'. Do we also want to update 'No description' and 'No information' for the description and modified fields? |
Yes please, let's apply it everywhere. |
Hey, I just made a Pull Request!
Adds a new conditional rule to the RBAC backend plugin. This rule can be used for multi tenant support. This will grant admins of Backstage the ability to allow team leads access to the RBAC plugins conditionally. This conditional access would limit these team leads to only being able to read, edit, and delete permission policies and roles that they are an owner of.
This also includes the new optional field
owner
for the role metadata that can be used alongside the newly added conditional rule.Include are some docs with a step by step example from both the admin's and the team lead's point of view. This can be used to help with testing.
Changes to the frontend:
Admin's point of view

Team lead's point of view

User's point of view

Note with the user's point of view, the first 404 page is from trying to access the RBAC page directly. In this case
http://localhost:3000/rbac
. The second is from trying to access the edit page directly for a particular role. Examplehttp://localhost:3000/rbac/role/role/default/team
.✔️ Checklist
Signed-off-by
line in the message. (more info)Notes
Worth some discussion on
Backend:
Frontend:
I had to change the permission that we used for the RBAC page fromEnded up updating the RBAC page so that it is once again protected by thepolicy.entity.read
topolicy.entity.create
. This is because we were using theusePermission
incorrectly and this was leading to issues whenever a condition was applied topolicy.entity.read
. An alternative to this could be how we handle theAdministration
here.policy.entity.read
permission.