Skip to content

Commit 5abd1fa

Browse files
committed
implemented permission based restrictions
1 parent c7136ce commit 5abd1fa

24 files changed

Lines changed: 12728 additions & 9305 deletions

File tree

addon/components/webhook/details.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</div>
88

99
<div class="flex items-center section-header-actions">
10-
<Button @icon="pencil" @text={{t "developers.component.webhook.details.update-details"}} @onClick={{this.onClickUpdateWebhook}} />
10+
<Button @icon="pencil" @text={{t "developers.component.webhook.details.update-details"}} @onClick={{this.onClickUpdateWebhook}} @permission={{@permission}} />
1111
</div>
1212
</div>
1313
<div class="text-sm content-panel-body">

addon/components/webhook/details.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
import Component from '@glimmer/component';
2+
import { tracked } from '@glimmer/tracking';
3+
import { inject as service } from '@ember/service';
24
import { action } from '@ember/object';
35

46
export default class WebhookDetailsComponent extends Component {
7+
@service abilities;
8+
@tracked permission;
9+
@tracked doesntHavePermission = false;
10+
11+
constructor(owner, { permission }) {
12+
super(...arguments);
13+
this.permission = permission;
14+
this.doesntHavePermission = permission && this.abilities.cannot(permission);
15+
}
16+
517
@action onClickUpdateWebhook() {
18+
if (this.doesntHavePermission) {
19+
return;
20+
}
21+
622
const { webhook, onClickUpdateWebhook } = this.args;
723

824
if (typeof onClickUpdateWebhook === 'function') {

0 commit comments

Comments
 (0)