Esempio n. 1
0
 /**
  * Given a permission string, check for access requirements
  *
  * @param string $str
  *   The permission to check.
  * @param int $contactID
  *   The contactID for whom the check is made.
  *
  * @return bool
  *   true if yes, else false
  */
 public static function check($str, $contactID = NULL)
 {
     if ($contactID == NULL) {
         $contactID = CRM_Core_Session::getLoggedInContactID();
     }
     if (!$contactID) {
         // anonymous user
         $contactID = 0;
     }
     return CRM_ACL_BAO_ACL::check($str, $contactID);
 }
Esempio n. 2
0
 /**
  * Given a permission string, check for access requirements
  *
  * @param string $str
  *   The permission to check.
  * @param int $contactID
  *   The contactID for whom the check is made.
  *
  * @return bool
  *   true if yes, else false
  */
 public static function check($str, $contactID = NULL)
 {
     if ($contactID == NULL) {
         $session = CRM_Core_Session::singleton();
         $contactID = $session->get('userID');
     }
     if (!$contactID) {
         // anonymous user
         $contactID = 0;
     }
     return CRM_ACL_BAO_ACL::check($str, $contactID);
 }
Esempio n. 3
0
 /**
  * given a permission string, check for access requirements
  *
  * @param string $str       the permission to check
  * @param int    $contactID the contactID for whom the check is made
  *
  * @return boolean true if yes, else false
  * @static
  * @access public
  */
 static function check($str, $contactID = null)
 {
     if ($contactID == null) {
         $session = CRM_Core_Session::singleton();
         $contactID = $session->get('userID');
     }
     if (!$contactID) {
         $contactID = 0;
         // anonymous user
     }
     require_once 'CRM/ACL/BAO/ACL.php';
     return CRM_ACL_BAO_ACL::check($str, $contactID);
 }