Skip to content

Commit

Permalink
fix: permissions for different ctx's and add read possibility via edi…
Browse files Browse the repository at this point in the history
…t-button
  • Loading branch information
StephGit committed Jan 3, 2025
1 parent 2292e15 commit d9001ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ export class ResourceFunctionsListComponent implements OnInit, OnDestroy {
canShowInstanceFunctions: this.authService.hasPermission(RESOURCE_PERM, Action.READ),
canShowSuperTypeFunctions: this.authService.hasPermission(RESOURCETYPE_PERM, Action.READ),
canAdd:
(this.contextId() === 1 || this.contextId === null) &&
this.contextId() === 1 &&
this.authService.hasResourceGroupPermission(RESOURCE_PERM, Action.CREATE, this.resource().resourceGroupId),
canEdit:
(this.contextId() === 1 || this.contextId === null) &&
this.authService.hasResourceGroupPermission(RESOURCE_PERM, Action.UPDATE, this.resource().resourceGroupId),
canEdit: this.authService.hasResourceGroupPermission(
RESOURCE_PERM,
Action.UPDATE,
this.resource().resourceGroupId,
),
canDelete:
(this.contextId() === 1 || this.contextId === null) &&
this.contextId() === 1 &&
this.authService.hasResourceGroupPermission(RESOURCE_PERM, Action.DELETE, this.resource().resourceGroupId),
};
} else {
Expand Down Expand Up @@ -84,7 +86,7 @@ export class ResourceFunctionsListComponent implements OnInit, OnDestroy {
result.push({
title: 'Resource Type Functions',
entries: resource,
canOverwrite: this.permissions().canEdit || this.permissions().canShowSuperTypeFunctions,
canOverwrite: this.permissions().canEdit && this.contextId() === 1,
});
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ export class ResourceTypeFunctionsListComponent {
canShowInstanceFunctions: this.authService.hasPermission(RESOURCETYPE_PERM, Action.READ),
canShowSuperTypeFunctions: this.authService.hasPermission(RESOURCETYPE_PERM, Action.READ),
canAdd:
(this.contextId() === 1 || this.contextId === null) &&
this.contextId() === 1 &&
this.authService.hasResourceTypePermission(RESOURCETYPE_PERM, Action.CREATE, this.resourceType().name),
canEdit:
(this.contextId() === 1 || this.contextId === null) &&
this.authService.hasResourceTypePermission(RESOURCETYPE_PERM, Action.UPDATE, this.resourceType().name),
canEdit: this.authService.hasResourceTypePermission(RESOURCETYPE_PERM, Action.UPDATE, this.resourceType().name),
canDelete:
(this.contextId() === 1 || this.contextId === null) &&
this.contextId() === 1 &&
this.authService.hasResourceTypePermission(RESOURCETYPE_PERM, Action.DELETE, this.resourceType().name),
};
} else {
Expand Down Expand Up @@ -83,7 +81,7 @@ export class ResourceTypeFunctionsListComponent {
result.push({
title: 'Supertype Functions',
entries: resource,
canOverwrite: this.permissions().canEdit || this.permissions().canShowSuperTypeFunctions,
canOverwrite: this.permissions().canEdit && this.contextId() === 1,
});
}
return result;
Expand Down

0 comments on commit d9001ec

Please sign in to comment.