Question

I have a front end module that I have developed, which I want to restrict to logged in users only. Stressing this is front end users, not admin users we are talking about.

I assume this can be done through ACL settings in much the same way the admin modules do - however I can't find the answer anywhere.

Is this possible or is it necessary to check on every action that they are logged in (I want to avoid doing this as it has a large margin for error - I simply only want logged in users to access said pages)?

Was it helpful?

Solution

No, there is no ACL for the frontend. To allow access to logged in users in your custom controller, you can do it the same way as the Magento_Customer module, as described here: Magento 2 - Check login for page in custom module

If necessary, add an additional check for the customer group.

But if you want to be able to configure an ACL for customer groups, you'll have to implement that from scratch, although ou will probably be able to reuse some parts of the admin module.

OTHER TIPS

I see it was been a lot of time ago but maybe this will be actual for some other people. Looks like this module could be helpful: https://github.com/di-zed/m2-front-acl

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top