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

1 Answer 1


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.


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

  • Thank you, it still returns a 403 though? Could this be a Craft bug with permissions?
    – Aron15
    Apr 12, 2019 at 9:54
  • @Aron15 please see my edit Apr 12, 2019 at 10:13
  • Thank you both!
    – Aron15
    Apr 12, 2019 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.