<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
protected $_viewPermissionedGroups;
protected $_editPermissionedGroups;
+ /**
+ * given a permission string, check for access requirements
+ *
+ * @param string $str the permission to check
+ *
+ * @param null $contactID
+ *
+ * @return boolean true if yes, else false
+ * @access public
+ */
+ function check($str, $contactID = NULL) {
+ $str = $this->translatePermission($str, 'Drupal6', array(
+ 'view user account' => 'access user profiles',
+ 'administer users' => 'administer users',
+ ));
+ if ($str == CRM_Core_Permission::ALWAYS_DENY_PERMISSION) {
+ return FALSE;
+ }
+ if ($str == CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
+ return TRUE;
+ }
+ if (function_exists('user_access')) {
+ return user_access($str) ? TRUE : FALSE;
+ }
+ return TRUE;
+ }
+
/**
* Given a roles array, check for access requirements
*
* Get the permissions defined in the hook_civicrm_permission implementation
* of the given module.
*
+ * @param $module
+ *
* @return Array of permissions, in the same format as CRM_Core_Permission::getCorePermissions().
*/
static function getModulePermissions($module) {