Browse Source

adding permissions for the hcp-link-service

CC-7146/Sidebar-item-for-linking-status
Chris Hut 10 months ago
parent
commit
cf917109c2
  1. 10
      ui/packages/consul-ui/app/abilities/operator.js
  2. 9
      ui/packages/consul-ui/app/services/hcp-link-status.js

10
ui/packages/consul-ui/app/abilities/operator.js

@ -0,0 +1,10 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import BaseAbility from './base';
export default class OperatorAbility extends BaseAbility {
resource = 'operator';
}

9
ui/packages/consul-ui/app/services/hcp-link-status.js

@ -3,19 +3,24 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import Service from '@ember/service';
import Service, { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
const LOCAL_STORAGE_KEY = 'consul:hideHcpLinkBanner';
export default class HcpLinkStatus extends Service {
@service abilities;
@tracked
alreadyLinked = false;
@tracked
userDismissedBanner = false;
get shouldDisplayBanner() {
return !this.alreadyLinked && !this.userDismissedBanner;
return !this.alreadyLinked && !this.userDismissedBanner && this.hasPermissionToLink;
}
get hasPermissionToLink() {
return this.abilities.can('write operators') && this.abilities.can('write acls');
}
constructor() {

Loading…
Cancel
Save