2020-10-08 15:52:09 +00:00
|
|
|
import { helper } from '@ember/component/helper';
|
|
|
|
|
|
|
|
export default helper(function serviceIntentionPermissions([params] /*, hash*/) {
|
|
|
|
const hasPermissions = params.Intention.HasPermissions;
|
|
|
|
const allowed = params.Intention.Allowed;
|
2021-04-12 18:57:56 +00:00
|
|
|
const notExplicitlyDefined = params.Source === 'specific-intention' && !params.TransparentProxy;
|
2020-10-08 15:52:09 +00:00
|
|
|
|
|
|
|
switch (true) {
|
|
|
|
case hasPermissions:
|
|
|
|
return 'allow';
|
|
|
|
case !allowed && !hasPermissions:
|
|
|
|
return 'deny';
|
2021-04-12 18:57:56 +00:00
|
|
|
case allowed && notExplicitlyDefined:
|
|
|
|
return 'notDefined';
|
2020-10-08 15:52:09 +00:00
|
|
|
default:
|
|
|
|
return 'allow';
|
|
|
|
}
|
|
|
|
});
|