Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
D
Developer Documentation
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Documentation
  • Docs
  • Developer Documentation
  • Issues
  • #553

Closed
Open
Opened Nov 01, 2018 by MikeyMJCO@MikeyMJCOOwner

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

  1. in the foo.ang.php file add
\Civi::resources()->addPermissions(['edit all contacts']);
  1. in the foo.js file add
$scope.checkPerm = CRM.checkPerm;
  1. 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>
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: documentation/docs/dev#553