This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
🤖 Generated by Copilot at 73ca242
Refactored the codebase to use the
userHasAccess
function and theuseUserHasAccessHook
hook for checking user permissions based on scopes. This improved the code consistency, flexibility, and readability across various components and files, such asProjectTable.tsx
,UserPermissionDrawer.tsx
,ProfileMenu.tsx
,ProjectsPage.tsx
, andSettingMenu.tsx
. Removed unused or redundant code, such asuserIsAdmin
andhasProjectWriteAccess
.References
refs #9161
Explanation
🤖 Generated by Copilot at 73ca242
useUserHasAccessHook
anduserHasAccess
functions to check user permissions based on scopes instead of hard-coded admin roles (link, link, link, link)isAdmin
withhasProjectWritePermission
inProjectTable.tsx
, using the scopeprojects:write
for project-related actions such as update, push, invalidate, view, and delete (link, link, link, link, link, link, link, link)selfUserPermission
to useuserHasAccess
with the scopeprojects:write
instead ofadmin:admin
inUserPermissionDrawer.tsx
(link)MediaIconsBox/index.tsx
(link, link)hasAdminAccess
to useuseUserHasAccessHook
with the scopeadmin:admin
inProfileMenu.tsx
(link)hasAdminAccess
andhasEditorAccess
to useuserHasAccess
with the scopesadmin:admin
andeditor:write
inSettingMenu.tsx
(link)useUserHasAccessHook
anduserHasAccess
to return only the result of checking for the given scope, without checking foradmin:admin
as well, inuserHasAccess.ts
(link, link)userIsAdmin
fromuserHasAccess.ts
(link)isAdmin
withhasWriteAccess
inProjectsPage.tsx
, using the scopeeditor:write
for editor-related actions such as download, link, unlink, pull, and delete projects (link, link, link, link, link, link)🤖 Generated by Copilot at 73ca242
QA Steps
List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.
Checklist