RequirePermission not working 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
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