CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • smarty function to test if the user has a specific access
Pages: [1]

Author Topic: smarty function to test if the user has a specific access  (Read 851 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
smarty function to test if the user has a specific access
August 14, 2010, 04:24:09 pm
Hi,

Want to be able from one template to do something like

{if has_access ($user.id, "civicrm access")}
Then display a specific message, or add an autocomplete on a field...)
{/if}

More specifically, half of the links in the back office on the events go to CRM/Event/Page/EventInfo.tpl, that is a dead end of the admin, as she can go back to the manage interface

I'd like to customise the template so if the user has the right to manage the event, I display a message so it returns to
/civicrm/event/manage/eventInfo?reset=1&action=update


Any idea how to do that ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: smarty function to test if the user has a specific access
August 14, 2010, 04:57:51 pm

check:

templates/CRM/Case/Page/Tab.tpl

its calls the access function

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: smarty function to test if the user has a specific access
August 14, 2010, 06:10:10 pm

Code: [Select]
         {if $permission EQ 'edit' and
             call_user_func(array('CRM_Core_Permission','check'), 'access all cases and activities')}

Will use it, thanks

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • smarty function to test if the user has a specific access

This forum was archived on 2017-11-26.