standalone: reimplement permission check
authorRich Lott / Artful Robot <code.commits@artfulrobot.uk>
Mon, 20 Feb 2023 12:45:17 +0000 (12:45 +0000)
committerTim Otten <totten@civicrm.org>
Fri, 23 Jun 2023 20:27:44 +0000 (13:27 -0700)
CRM/Core/Permission/Standalone.php

index e6c0616fc01a7af10847d26483c73aa5e4b49263..a201f698aab5bace667a9e015441cd25e3c32282 100644 (file)
@@ -43,25 +43,13 @@ class CRM_Core_Permission_Standalone extends CRM_Core_Permission_Base {
     if ($str == CRM_Core_Permission::ALWAYS_ALLOW_PERMISSION) {
       return TRUE;
     }
+
+    if (class_exists(\Civi\Standalone\Security::class)) {
+      return \Civi\Standalone\Security::singleton()->checkPermission($this, $str, $userId);
+    }
+
     // return the stubbed permission (defaulting to true if the array is missing)
     return isset($this->permissions) && is_array($this->permissions) ? in_array($str, $this->permissions) : TRUE;
   }
 
-  /**
-   * Get the permissioned where clause for the user.
-   *
-   * @param int $type
-   *   The type of permission needed.
-   * @param array $tables
-   *   (reference ) add the tables that are needed for the select clause.
-   * @param array $whereTables
-   *   (reference ) add the tables that are needed for the where clause.
-   *
-   * @return string
-   *   the group where clause for this user
-   */
-  public function whereClause($type, &$tables, &$whereTables) {
-    return '( 1 )';
-  }
-
 }