Answers.Body: <p>You want:</p>
  
  <pre><code>{% requirePermission("editSite:#{currentSite.id}") %}
  </code></pre>
  
  <p>The way you have it now, the permission it's checking is the literal string <code>editSite: (currentSite.id)</code> which no one will have permission for.</p>
  
  <p><strong>Edit</strong>: </p>
  
  <p>Craft 3.1 doesn't store IDs anymore for permissions, instead it uses always the uids because of the project config. This is a breaking change for many existing projects so keep that in mind.</p>
  
  <pre><code>{% requirePermission("editSite:#{currentSite.uid}") %}
  </code></pre>
  
  <p>c.f.: <a href="https://twitter.com/nystudio107/status/938018528527036416" rel="nofollow noreferrer">Twig string interpolation</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-12T09:54:07.110Z
Answers.Text: Thank you, it still returns a 403 though? Could this be a Craft bug with permissions?
Answers.UserDisplayName: Aron15
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-12T10:13:23.043Z
Answers.Text: @Aron15 please see my edit
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-12T10:21:46.350Z
Answers.Text: Thank you both!
Answers.UserDisplayName: Aron15
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-12T00:59:24.543Z
Answers.LastActivityDate: 2019-04-12T10:12:26.613Z
Answers.LastEditDate: 2019-04-12T10:12:26.613Z
Answers.UserDisplayName: andrew.welch
Body: <p>I'm using the requirePermission tag in the templates for my Craft multisite. I only want users who have access to 'edit' that site be able to view it. </p>
  
  <p>My code is:</p>
  
  <pre><code>{% requirePermission('editSite: (currentSite.id)') %}
  </code></pre>
  
  <p>It works fine when logged in as admin, however it returns a 403 for every other user, regardless of their permissions. Please help!</p>
  
  <p><em>I'm aware I can use requireLogin but I want users to have access to some sites and not others</em></p>
  
Tags: <templating><permissions>
Title: RequirePermission not working
ThreadText: # RequirePermission not working
  
  (Asked by: username_0 on 2019-04-12)
  
  I'm using the requirePermission tag in the templates for my Craft multisite. I only want users who have access to 'edit' that site be able to view it.
  
  My code is:
  
  ```
  {% requirePermission('editSite: (currentSite.id)') %}
  
  ```
  
  It works fine when logged in as admin, however it returns a 403 for every other user, regardless of their permissions. Please help!
  
  *I'm aware I can use requireLogin but I want users to have access to some sites and not others*
  
  **Tags:** templating, permissions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-12. Score: 2 | Accepted answer
  
  You want:
  
  ```
  {% requirePermission("editSite:#{currentSite.id}") %}
  
  ```
  
  The way you have it now, the permission it's checking is the literal string `editSite: (currentSite.id)` which no one will have permission for.
  
  **Edit**:
  
  Craft 3.1 doesn't store IDs anymore for permissions, instead it uses always the uids because of the project config. This is a breaking change for many existing projects so keep that in mind.
  
  ```
  {% requirePermission("editSite:#{currentSite.uid}") %}
  
  ```
  
  c.f.: [Twig string interpolation](https://twitter.com/nystudio107/status/938018528527036416)
  
  > **Comments:**
  > **username_0**: Thank you, it still returns a 403 though? Could this be a Craft bug with permissions?  
  > **username_2**: @username_0 please see my edit  
  > **username_0**: Thank you both!  
  
  ---
  
  