Skip to content

Commit

Permalink
fix: manage all projects permissions, edit, view, delete, create gf-4…
Browse files Browse the repository at this point in the history
…11 (#424)

* fix: adjusted so creating, viewing and editing groups is allowed gf-411

* fix: adjusted so creating, viewing, deleting and editing groups is allowed gf-411

* fix: merge conflict on pull request gf-411

* fix: resolved merge conflict gf-411

* fix: adjusted project details menu to now show for manage users access permission gf-411
  • Loading branch information
Fjortis authored Sep 20, 2024
1 parent d17faac commit 3599a79
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ class ProjectGroupController extends BaseController {
),
method: "POST",
path: ProjectGroupsApiPath.ROOT,
preHandlers: [checkUserPermissions([PermissionKey.MANAGE_USER_ACCESS])],
preHandlers: [
checkUserPermissions([
PermissionKey.MANAGE_USER_ACCESS,
PermissionKey.MANAGE_ALL_PROJECTS,
]),
],
validation: {
body: projectGroupCreateValidationSchema,
},
Expand All @@ -81,7 +86,12 @@ class ProjectGroupController extends BaseController {
this.delete(options as APIHandlerOptions<{ params: { id: string } }>),
method: "DELETE",
path: ProjectGroupsApiPath.$ID,
preHandlers: [checkUserPermissions([PermissionKey.MANAGE_USER_ACCESS])],
preHandlers: [
checkUserPermissions([
PermissionKey.MANAGE_USER_ACCESS,
PermissionKey.MANAGE_ALL_PROJECTS,
]),
],
});

this.addRoute({
Expand All @@ -94,7 +104,12 @@ class ProjectGroupController extends BaseController {
),
method: "GET",
path: ProjectGroupsApiPath.$ID,
preHandlers: [checkUserPermissions([PermissionKey.MANAGE_USER_ACCESS])],
preHandlers: [
checkUserPermissions([
PermissionKey.MANAGE_USER_ACCESS,
PermissionKey.MANAGE_ALL_PROJECTS,
]),
],
});

this.addRoute({
Expand All @@ -107,6 +122,7 @@ class ProjectGroupController extends BaseController {
),
method: "PATCH",
path: ProjectGroupsApiPath.$ID,
preHandlers: [checkUserPermissions([PermissionKey.MANAGE_ALL_PROJECTS])],
validation: {
body: projectGroupPatchValidationSchema,
},
Expand Down
7 changes: 6 additions & 1 deletion apps/backend/src/modules/users/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ class UserController extends BaseController {
),
method: "GET",
path: UsersApiPath.ROOT,
preHandlers: [checkUserPermissions([PermissionKey.MANAGE_USER_ACCESS])],
preHandlers: [
checkUserPermissions([
PermissionKey.MANAGE_USER_ACCESS,
PermissionKey.MANAGE_ALL_PROJECTS,
]),
],
});

this.addRoute({
Expand Down
5 changes: 4 additions & 1 deletion apps/frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ createRoot(document.querySelector("#root") as HTMLElement).render(
{
element: (
<ProtectedRoute
routePermissions={[PermissionKey.MANAGE_USER_ACCESS]}
routePermissions={[
PermissionKey.MANAGE_USER_ACCESS,
PermissionKey.MANAGE_ALL_PROJECTS,
]}
>
<ProjectAccessManagement />
</ProtectedRoute>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ProjectDetailsMenu = ({
);

const hasManageProjectAccessPermission = checkHasPermission(
[PermissionKey.MANAGE_USER_ACCESS],
[PermissionKey.MANAGE_USER_ACCESS, PermissionKey.MANAGE_ALL_PROJECTS],
userPermissions,
);
const hasEditProjectPermission = checkHasPermission(
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3599a79

Please sign in to comment.