remove newly introduced trailing spaces & tabs, new windows line-breaks also present...
[civicrm-core.git] / CRM / Core / Permission.php
index 066cc4c357d333b6764608309072cdd0ced44505..52cc6f041a4b651017650957e751b60352cd28f5 100644 (file)
@@ -53,6 +53,16 @@ class CRM_Core_Permission {
    */
   CONST EDIT = 1, VIEW = 2, DELETE = 3, CREATE = 4, SEARCH = 5, ALL = 6, ADMIN = 7;
 
+  /**
+   * A placeholder permission which always fails
+   */
+  const ALWAYS_DENY_PERMISSION = "*always deny*";
+
+  /**
+   * A placeholder permission which always fails
+   */
+  const ALWAYS_ALLOW_PERMISSION = "*always allow*";
+
   /**
    * get the current permission of this user
    *
@@ -148,7 +158,8 @@ class CRM_Core_Permission {
       return TRUE;
     }
 
-    if (self::check('administer Multiple Organizations') &&
+    if (
+      self::check('administer Multiple Organizations') &&
       self::isMultisiteEnabled()
     ) {
       return TRUE;
@@ -162,7 +173,7 @@ class CRM_Core_Permission {
   }
 
   public static function customGroup($type = CRM_Core_Permission::VIEW, $reset = FALSE) {
-    $customGroups = CRM_Core_PseudoConstant::customGroup($reset);
+    $customGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id', array('fresh' => $reset));
     $defaultGroups = array();
 
     // check if user has all powerful permission
@@ -198,7 +209,7 @@ class CRM_Core_Permission {
   }
 
   public static function ufGroup($type = CRM_Core_Permission::VIEW) {
-    $ufGroups = CRM_Core_PseudoConstant::ufGroup();
+    $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
 
     $allGroups = array_keys($ufGroups);
 
@@ -268,7 +279,11 @@ class CRM_Core_Permission {
     if (!$eventID) {
       return $permissionedEvents;
     }
-    return array_search($eventID, $permissionedEvents) === FALSE ? NULL : $eventID;
+    if (!empty($permissionedEvents)){
+      return array_search($eventID, $permissionedEvents) === FALSE ? NULL : $eventID;
+    } else {
+      return $eventID;
+    }
   }
 
   static function eventClause($type = CRM_Core_Permission::VIEW, $prefix = NULL) {
@@ -451,6 +466,7 @@ class CRM_Core_Permission {
       'import contacts' => $prefix . ts('import contacts'),
       'edit groups' => $prefix . ts('edit groups'),
       'administer CiviCRM' => $prefix . ts('administer CiviCRM'),
+      'skip IDS check' => $prefix . ts('skip IDS check'),
       'access uploaded files' => $prefix . ts('access uploaded files'),
       'profile listings and forms' => $prefix . ts('profile listings and forms'),
       'profile listings' => $prefix . ts('profile listings'),