salix/front/core/directives/visible-by.js

18 lines
461 B
JavaScript

import ngModule from '../module';
function vnVisibleBy(aclService) {
return {
restrict: 'A',
priority: -1,
link: function($scope, $element, $attrs) {
let acls = $attrs.vnVisibleBy.split(',');
if (!aclService.aclPermission(acls)) {
$element[0].style.visibility = 'hidden';
}
}
};
}
vnVisibleBy.$inject = ['aclService'];
ngModule.directive('vnVisibleBy', vnVisibleBy);