mirror of https://github.com/status-im/consul.git
22 lines
757 B
JavaScript
22 lines
757 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import BaseAbility, { ACCESS_READ, ACCESS_WRITE } from './base';
|
|
|
|
export default class ServiceInstanceAbility extends BaseAbility {
|
|
resource = 'service';
|
|
generateForSegment(segment) {
|
|
// When we ask for service-instances its almost like a request for a single service
|
|
// When we do that we also want to know if we can read/write intentions for services
|
|
// so here we add intentions read/write for the specific segment/service prefix
|
|
return super
|
|
.generateForSegment(...arguments)
|
|
.concat([
|
|
this.permissions.generate('intention', ACCESS_READ, segment),
|
|
this.permissions.generate('intention', ACCESS_WRITE, segment),
|
|
]);
|
|
}
|
|
}
|