open-consul/ui/packages/consul-ui/app/helpers/service/intention-permissions.js

19 lines
572 B
JavaScript
Raw Normal View History

import { helper } from '@ember/component/helper';
export default helper(function serviceIntentionPermissions([params] /*, hash*/) {
const hasPermissions = params.Intention.HasPermissions;
const allowed = params.Intention.Allowed;
const notExplicitlyDefined = params.Source === 'specific-intention' && !params.TransparentProxy;
switch (true) {
case hasPermissions:
return 'allow';
case !allowed && !hasPermissions:
return 'deny';
case allowed && notExplicitlyDefined:
2021-04-14 22:52:41 +00:00
return 'not-defined';
default:
return 'allow';
}
});