CRM-12413 - Return an error when api-key does not have an associated CMS user
authorColby Warkentin <colby.warkentin@p2c.com>
Tue, 23 Apr 2013 23:21:46 +0000 (16:21 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 30 Apr 2013 19:40:49 +0000 (12:40 -0700)
----------------------------------------
* CRM-12413: CiviCRM does not error on an api-key given through the REST interface that is not connected to a CMS user
  http://issues.civicrm.org/jira/browse/CRM-12413

CRM/Utils/REST.php

index a55ca67d66f1ccb6eb6e85e68c9f517d37c5abc6..3fa52d2ddf023ed502938f3b247621c2b55c5557 100644 (file)
@@ -679,6 +679,11 @@ class CRM_Utils_REST {
     if ($uid) {
       CRM_Utils_System::loadBootStrap(array('uid' => $uid), TRUE, FALSE);
     }
+    else {
+      $err = array('error_message' => 'no CMS user associated with given api-key', 'is_error' => 1);
+      echo self::output($err);
+      CRM_Utils_System::civiExit();
+    }
   }
 }