How can I tell if the currently logged-in user has a certain permission in CiviCRM?

Should I use CMS-dependent functions, like user_access('permission') in Drupal, or can I use one CiviCRM function to check the permission for the current user?

For example, how could I display a message if the currently logged-in user has the 'edit all contacts' permission?

  • Tell where? Template? Drupal module? CiviCRM extension? – choster Apr 1 '15 at 16:08

I believe what you're looking for is:

CRM_Core_Permission::check('edit all contacts')
  • Ugh, I forgot this, Googled it, found my own answer. Wish I could upvote it! :) – Jon G - Megaphone Tech Jun 29 '16 at 17:31

It depends how you've set the permissions, what ACL groups they're in or what roles you've given them in the CMS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.