Skip to content

Commit

Permalink
Fix editing of plan tags (#1166)
Browse files Browse the repository at this point in the history
* Restore plan update permissions entry
  • Loading branch information
AaronPlave authored Mar 18, 2024
1 parent 0a94407 commit 85b7de7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/components/plan/PlanForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
let hasPlanUpdatePermission: boolean = false;
$: permissionError = $planReadOnly ? PlanStatusMessages.READ_ONLY : 'You do not have permission to edit this plan.';
$: {
if (plan && user) {
hasPlanUpdatePermission = featurePermissions.plan.canUpdate(user, plan) && !$planReadOnly;
Expand Down
5 changes: 4 additions & 1 deletion src/utilities/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,9 @@ const queryPermissions = {
isUserAdmin(user) || (getPermission(['update_expansion_rule_by_pk'], user) && isUserOwner(user, expansionRule))
);
},
UPDATE_PLAN: (user: User | null, plan: PlanWithOwners): boolean => {
return isUserAdmin(user) || (getPermission(['update_plan_by_pk'], user) && isPlanOwner(user, plan));
},
UPDATE_PLAN_SNAPSHOT: (user: User | null): boolean => {
return getPermission(['update_plan_snapshot_by_pk'], user);
},
Expand Down Expand Up @@ -1021,7 +1024,7 @@ const featurePermissions: FeaturePermissions = {
canCreate: user => queryPermissions.CREATE_PLAN(user),
canDelete: (user, plan) => queryPermissions.DELETE_PLAN(user, plan),
canRead: user => queryPermissions.GET_PLAN(user),
canUpdate: () => false, // no feature to update plan exists
canUpdate: (user, plan) => queryPermissions.UPDATE_PLAN(user, plan),
},
planBranch: {
canCreateBranch: (user, plan, model) => queryPermissions.DUPLICATE_PLAN(user, plan, model),
Expand Down

0 comments on commit 85b7de7

Please sign in to comment.