Japhy
June 24, 2023, 9:39am
1
I have a site that’s behind a login. Using the plugin for that
Within my restricted site I want one page to be accessible for a certain group of users only.
So I created a group (guest) for these users. I added the group to the users. End of yaml files look like this.
groups:
- guest
avatar: { }
hashed_password: removed
access:
site:
login: true
But how would that look? Starting point is this
Parent
access:
site.login: true
admin.login: true
login:
visibility_requires_access: true
The child page in question was
login:
visibility_requires_access: true
permissions:
inherit: true
On the child page I want to only allow group ’ guest’,
I would expect this to work, but it doesn´t
login:
visibility_requires_access: true
access:
site.login: true
admin.login: true
site.guest: true
Everyone has access
b.da
June 25, 2023, 2:35pm
2
Hi @Japhy , take a look at the first part of the post below - I think it’s what you need. so,
you need to register a new permission
in group configuration, set Site YourPermission to Allowed
on the Page Security tab, set Page Access
I wanted to find a solution that didn’t remove built-in functionality, finally got it to working So, we are registering a new permission in our theme.
1. <YourTheme>.php <?php
namespace Grav\Theme;
use Grav\Common\Grav;
use Grav\Common\Theme;
use Grav\Events\PermissionsRegisterEvent;
use Grav\Framework\Acl\PermissionsReader;
class <YourTheme> extends Theme
{
public static function getSubscribedEvents()
{
return [
PermissionsRegisterEvent::…
and also on this topic
Japhy
June 25, 2023, 4:25pm
3
Thanks so much @b.da . By reading the posts you mentioned I realized what I was missing. I had not registered a permissions for admin plugin use so I guess I had to add this to the user yaml myself
access:
site:
login: true
guest: true
And then on the specific page
login:
visibility_requires_access: true
access:
site.guest: true