Merge pull request #5769 from monishdeb/CRM-16433
[civicrm-core.git] / CRM / ACL / API.php
index 8ed7a94427a8fb6437e046580c32aa48739ebb19..f3681b3fa8702eb91c056b0150f1f95fd82cb7d1 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
 class CRM_ACL_API {
 
   /**
-   * The various type of permissions
+   * The various type of permissions.
    *
    * @var int
    */
@@ -54,9 +54,8 @@ class CRM_ACL_API {
    * @param int $contactID
    *   The contactID for whom the check is made.
    *
-   * @return boolean
+   * @return bool
    *   true if yes, else false
-   * @static
    */
   public static function check($str, $contactID = NULL) {
     if ($contactID == NULL) {
@@ -73,7 +72,7 @@ class CRM_ACL_API {
   }
 
   /**
-   * Get the permissioned where clause for the user
+   * Get the permissioned where clause for the user.
    *
    * @param int $type
    *   The type of permission needed.
@@ -144,7 +143,7 @@ class CRM_ACL_API {
   }
 
   /**
-   * Get all the groups the user has access to for the given operation
+   * Get all the groups the user has access to for the given operation.
    *
    * @param int $type
    *   The type of permission needed.
@@ -205,11 +204,12 @@ class CRM_ACL_API {
   ) {
 
     static $cache = array();
+    $groups = array();
     //@todo this is pretty hacky!!!
     //adding a way for unit tests to flush the cache
     if ($flush) {
       $cache = array();
-      return;
+      return NULL;
     }
     if (!$contactID) {
       $session = CRM_Core_Session::singleton();
@@ -230,4 +230,5 @@ class CRM_ACL_API {
 
     return in_array($groupID, $groups) ? TRUE : FALSE;
   }
+
 }