拒绝访问我在 prestashop 中的自定义模块

Denying access to my custom module in prestashop

我在 prestashop 中创建了一个自定义模块,但我不知道如何处理对该模块的访问。我没有找到任何关于它的文档。我知道如何在 symfony 中做到这一点,但在 prestashop 中却不知道。 我只想让一组用户访问我的模块。有人知道该怎么做或有 link 文档来帮助我吗?

您可以检查登录用户是否属于特定组。下面的示例展示了如何在控制器中检查用户的默认组。基于此,您可以继续限制您的模块。

if ($this->context->customer->isLogged()) {
    $customerGroupId = $this->context->customer->id_default_group;
}