<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>

CC BY-SA 4.0
2019-04-12T09:54:07.110Z
Thank you, it still returns a 403 though? Could this be a Craft bug with permissions?
Aron15
CC BY-SA 4.0
2019-04-12T10:13:23.043Z
@Aron15 please see my edit
Robin Schambach
CC BY-SA 4.0
2019-04-12T10:21:46.350Z
Thank you both!
Aron15
CC BY-SA 4.0
2019-04-12T00:59:24.543Z
2019-04-12T10:12:26.613Z
2019-04-12T10:12:26.613Z
andrew.welch
<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>

<templating><permissions>
RequirePermission not working
# 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

> **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!  

---

