Answers.Body: <p>I think you can bypass permission using <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_permission_check/" rel="nofollow noreferrer">permission_check</a> hook.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-03T12:40:16.313Z
Answers.LastActivityDate: 2018-01-03T12:40:16.313Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p><strong>Background</strong></p>
  
  <p>I am working on a React app for event participation management using the CiviCRM ajax API. There is a little more to this that isn't relevant.</p>
  
  <p>Each user has access to their own API key, but no CiviCRM or CMS account. I have used the civitest_civicrm_alterAPIPermissions hook to expose/restrict various entities. I have given each user the "access AJAX API" permission.</p>
  
  <p><strong>Issue</strong></p>
  
  <p>Before I go looking through the code, I had a question about an issue I am having: </p>
  
  <p>Users with CMS accounts and the exact same permissions (i.e. no "access CiviCRM" and cannot log into CMS) can access the API fine, but those without get the error "ERROR: No CMS user associated with given api-key"</p>
  
  <p>The error is pretty self explanatory, but I was curious if there was a way to work around it that is built into CiviCRM.</p>
  
  <p><strong>Setup</strong> </p>
  
  <p>Joomla 3.8</p>
  
  <p>CiviCRM 4.7.22</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-03T07:37:08.853Z
Comments.Text: I doubt if you can skip the CMS user, because the permissions are assigned to the CMS user (in the case of Drupal). Maybe the description of bootstrapping CiviCRM, see https://docs.civicrm.org/dev/en/latest/framework/bootstrap/ is useful.
Comments.UserDisplayName: Kainuk - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-03T10:11:46.470Z
Comments.Text: I do agree with @Kainuk-CiviCooP point. But, If you want to access CiviCRM without a drupal user account - then don't try to access rest api directly - you may use plain PHP file in the extension and then try connecting to the rest api  - ( I was about to test this but didn't get a chance to do so) - good luck
Comments.UserDisplayName: Ramesh - ARTECH Consultancy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-03T17:18:16.627Z
Comments.Text: Thanks for the help. I went through the Rest.php file and see what you mean. In Joomla, the anonymous (Public) users group is given their own permission set. The CMS user is unnecessary in this case. I will look into creating my own script. However, it may just be easier to create the contact a CMS user with no groups; this will give that contact the same permissions as an anonymous (Public) user.
Comments.UserDisplayName: David Hayes
Tags: <api><permissions><ajax>
Title: CiviCRM AJAX api Permissions
ThreadText: # CiviCRM AJAX api Permissions
  
  (Asked by: username_0 on 2018-01-02)
  
  **Background**
  
  I am working on a React app for event participation management using the CiviCRM ajax API. There is a little more to this that isn't relevant.
  
  Each user has access to their own API key, but no CiviCRM or CMS account. I have used the civitest\_civicrm\_alterAPIPermissions hook to expose/restrict various entities. I have given each user the "access AJAX API" permission.
  
  **Issue**
  
  Before I go looking through the code, I had a question about an issue I am having:
  
  Users with CMS accounts and the exact same permissions (i.e. no "access CiviCRM" and cannot log into CMS) can access the API fine, but those without get the error "ERROR: No CMS user associated with given api-key"
  
  The error is pretty self explanatory, but I was curious if there was a way to work around it that is built into CiviCRM.
  
  **Setup**
  
  Joomla 3.8
  
  CiviCRM 4.7.22
  
  **Tags:** api, permissions, ajax
  
  > **Comments:**
  > **username_1**: I doubt if you can skip the CMS user, because the permissions are assigned to the CMS user (in the case of Drupal). Maybe the description of bootstrapping CiviCRM, see https://docs.civicrm.org/dev/en/latest/framework/bootstrap/ is useful.  
  > **username_2**: I do agree with @Kainuk-CiviCooP point. But, If you want to access CiviCRM without a drupal user account - then don't try to access rest api directly - you may use plain PHP file in the extension and then try connecting to the rest api  - ( I was about to test this but didn't get a chance to do so) - good luck  
  > **username_0**: Thanks for the help. I went through the Rest.php file and see what you mean. In Joomla, the anonymous (Public) users group is given their own permission set. The CMS user is unnecessary in this case. I will look into creating my own script. However, it may just be easier to create the contact a CMS user with no groups; this will give that contact the same permissions as an anonymous (Public) user.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2018-01-03. Score: 0 | Accepted answer
  
  I think you can bypass permission using [permission\_check](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_permission_check/) hook.
  
  
  ---
  
  