How to do permission checks in angular
Created by: eileenmcnaughton
Just making some notes on something I just learnt - to check for permissions in an angular page in an extension
- in the foo.ang.php file add
\Civi::resources()->addPermissions(['edit all contacts']);
- in the foo.js file add
$scope.checkPerm = CRM.checkPerm;
- this can then be used in your angular html -eg
<p ng-if="checkPerm('edit all contacts')"> you are all powerful and can wreak havoc </p>