fix(portal): Project Tab Access Permissions Match the User Permissions#22708
fix(portal): Project Tab Access Permissions Match the User Permissions#22708vg006 wants to merge 7 commits intogoharbor:mainfrom
Conversation
|
To the maintainers @bupd, @Vad1mo, @OrlinVasilev, @stonezdj, @MinerYang, @chlins. There are few tabs such as As suggested in the issue, do other tabs need to be updated, such that only member with Thus the PR can be updated with the overall recommended changes in the Project tabs' components and modules. |
Hello @vg006, follow what the backend follows, that is if backend doesnt allow user to READ - dont show the tab, if it doesnt allow EDIT / CREATE - disable the buttons. Hope this helps. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #22708 +/- ##
=======================================
Coverage 66.01% 66.02%
=======================================
Files 1073 1073
Lines 116495 116511 +16
Branches 2939 2944 +5
=======================================
+ Hits 76903 76924 +21
+ Misses 35338 35337 -1
+ Partials 4254 4250 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@bupd I assure that my changes are tested and safer to merge, but can you review the changes once and share your comments? |
|
This branch is rebased on top of upstream's main branch and is now ready for merge. |
bupd
left a comment
There was a problem hiding this comment.
@vg006 I believe we should not change the permissions here. READ permission should be enough to view the tabs.
Scanner and config tab may not be valuable to limited guest and guest roles though. other roles can infer what the project is.
given that all roles have read permission on the config means simply are we going to show it in ui or not. and I see no value in showing config tab to a guest role.
Head branch was pushed to by a user without write access
There was a problem hiding this comment.
Pull request overview
This PR attempts to fix a UX issue (#22639) where Limited Guest and Guest users could see project tabs (Scanner, Configuration) they couldn't fully use, causing 403 errors. The fix hides the Scanner and Configuration tabs from Guest/LimitedGuest users via role-name checks in the tab permission lambdas, and adds component-level redirects so that direct URL access is also blocked.
Changes:
project-detail.component.ts: Adds anisLimitedGuestOrGuest()method and uses it to hide the Scanner and Configuration tabs for Guest/LimitedGuest usersscanner.component.ts: Adds a role-based redirect inngOnInitthat sends Guest/LimitedGuest users to the projects listproject-config.component.ts: Adds a role-based redirect inngOnInitthat sends Guest/LimitedGuest users to the projects list
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
project-detail/project-detail.component.ts |
Adds isLimitedGuestOrGuest() helper and uses it in the Scanner and Config tab permission expressions |
scanner/scanner.component.ts |
Imports Router and CommonRoutes; adds redirect for Guest/LimitedGuest in ngOnInit |
project-config/project-config.component.ts |
Imports CommonRoutes; adds redirect for Guest/LimitedGuest in ngOnInit |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/portal/src/app/base/project/project-detail/project-detail.component.ts
Show resolved
Hide resolved
src/portal/src/app/base/project/project-config/project-config.component.ts
Show resolved
Hide resolved
src/portal/src/app/base/project/project-detail/project-detail.component.ts
Show resolved
Hide resolved
src/portal/src/app/base/project/project-config/project-config.component.ts
Outdated
Show resolved
Hide resolved
src/portal/src/app/base/project/project-detail/project-detail.component.ts
Show resolved
Hide resolved
|
Sure I will, working on it. |
Head branch was pushed to by a user without write access
Signed-off-by: vg006 <devvg006@gmail.com>
Signed-off-by: vg006 <devvg006@gmail.com>
Signed-off-by: vg006 <devvg006@gmail.com>
Signed-off-by: vg006 <devvg006@gmail.com>
Signed-off-by: vg006 <devvg006@gmail.com>
Signed-off-by: vg006 <devvg006@gmail.com>
Signed-off-by: vg006 <devvg006@gmail.com>












Comprehensive Summary of your change
Issue being fixed
Fixes #22639
As mentioned in the issue, This PR updates the component and module, such that only the
Project Admincan view and edit the project configuration. Other than theProject Admin, the tabs is set to be inaccessible.Also updated the
project.module.tsfile, so that the page is redirected to the Projects, if an unauthorized member attempts to visit the restricted tabs accordingly.As Limited Guest
As Guest
Please indicate you've done the following:
release-note/update,release-note/enhancement