Access, Guest, and View Private Resources

Hi all,

I’ve been trying to get Guest and Access modules to work to control access. I just can’t seem to get Access to restrict access and I think it has to do with the .htaccess file…

I gave up on Access and (inspired by View Private Resources) I modified/added to the Guest module to grant access to resources (items, media, and item sets) that are set to private.

Here is what I did…

protected function addRulesForGuest(LaminasAcl $acl): void
{
    $roles = $acl->getRoles();
    $acl
// my addition...
        ->allow(
            [Acl::ROLE_GUEST, 'guest_private'],
            [\Omeka\Entity\Resource::class],
            ['view-all']
        );
}

It works, but I would like to make it more granular… Instead of providing access to all resources I wanted to just provide it to media. How can I target specific resources to change access on just that resource?
I’ve tried

->allow(
    [Acl::ROLE_GUEST, 'guest_private'],
    [\Omeka\Entity\Media::class],
    ['view-all']
);

and I tried

->allow(
    [Acl::ROLE_GUEST, 'guest_private'],
    [\Omeka\Entity\Media::class],
    ['read']
);

Among other attempts, nothing I have tried so far worked…

Any assistance or guidance with this would be greatly appreciated.
Thanks,

Following up on this since I did not get any response.

The two modules Access and Guest work fine together.

Note that Access is designed to check accesses to files, not to the item records, because most of the times the users need to know that something exist to ask an access to it.

To control access to files requires to add a lines in .htaccess.