Answers.Body: <p>I think you are correct that SearchKit permissions don't integrate with ACL's yet.</p>
  <p>Maybe you could create a permission for your form, grant it to your Drupal role and configure SK to use it.  I don't think your extension would need to do anything more than define the permission with <code>hook_civicrm_permission()</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-30T12:59:20.127Z
Answers.Text: Thanks Aidan - I thought this might be the case.  I'll do just that.  Does anyone know if this is on the roadmap?
Answers.UserDisplayName: ChumKui
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-30T13:11:31.283Z
Answers.Text: It's not on https://lab.civicrm.org/dev/core/-/issues/3761  I suggest you create a core issue ticket for an 'improvement' and then add it to the end of the 'Other improvements' section of 3761.  One possible way to address it (if this permissions approach works) is to provide an option on FB to generate a unique permission, similar to the way it can create menu links.
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T17:39:45.787Z
Answers.LastActivityDate: 2023-03-29T17:39:45.787Z
Answers.UserDisplayName: Aidan
Body: <p>I suspect the answer is 'you'll have to code it...', but SearchKit has advanced so rapidly, I thought it was worth asking the question.</p>
  <p>I have a search form that I need to secure for a certain group of users.  ACLs do just about everything I need along with Drupal permissions/roles.  I want to be able to control access to a SearchKit form, but the only way I can do this by the looks of it is to choose a particular CiviCRM permission?</p>
  <p>The ideal way would be to make it consistent with the rest of CiviCRM and control it through ACLs  - at the moment you can choose to secure groups of contacts, profiles, custom data and events, but not unfortunately anything related to SearchKit/Afform.</p>
  <p>So do I have use a hook_civicrm_permission to create the particular permissions I need?</p>
  
Tags: <searchkit>
Title: Adding permissions for SearchKit forms
ThreadText: # Adding permissions for SearchKit forms
  
  (Asked by: username_0 on 2023-03-29)
  
  I suspect the answer is 'you'll have to code it...', but SearchKit has advanced so rapidly, I thought it was worth asking the question.
  
  I have a search form that I need to secure for a certain group of users. ACLs do just about everything I need along with Drupal permissions/roles. I want to be able to control access to a SearchKit form, but the only way I can do this by the looks of it is to choose a particular CiviCRM permission?
  
  The ideal way would be to make it consistent with the rest of CiviCRM and control it through ACLs - at the moment you can choose to secure groups of contacts, profiles, custom data and events, but not unfortunately anything related to SearchKit/Afform.
  
  So do I have use a hook\_civicrm\_permission to create the particular permissions I need?
  
  **Tags:** searchkit
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-29. Score: 2 | Accepted answer
  
  I think you are correct that SearchKit permissions don't integrate with ACL's yet.
  
  Maybe you could create a permission for your form, grant it to your Drupal role and configure SK to use it. I don't think your extension would need to do anything more than define the permission with `hook_civicrm_permission()`.
  
  > **Comments:**
  > **username_0**: Thanks username_1 - I thought this might be the case.  I'll do just that.  Does anyone know if this is on the roadmap?  
  > **username_1**: It's not on https://lab.civicrm.org/dev/core/-/issues/3761  I suggest you create a core issue ticket for an 'improvement' and then add it to the end of the 'Other improvements' section of 3761.  One possible way to address it (if this permissions approach works) is to provide an option on FB to generate a unique permission, similar to the way it can create menu links.  
  
  ---
  
  