1. Go to this page and download the library: Download andersundsehr/group_access library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
andersundsehr / group_access example snippets
#[GroupAccess([2, 6])]
class CustomerController extends ActionController
{
public function overviewAction(): ResponseInterface
{
//this action is only accessible if the Frontend User has group 2 or 6
}
#[GroupAccess([7])]
public function listAction(): ResponseInterface
{
//this action is only accessible if the Frontend User has group (2 or 6) and 7
}
}
class ProjectController extends ActionController
{
public function overviewAction(): ResponseInterface
{
//this action is only accessible for all users and without user login
}
#[GroupAccess([7, 9, 12])]
public function listAction(): ResponseInterface
{
//this action is only accessible if the Frontend User has group 7 or 9 or 12
}
#[GroupAccess([3])]
#[GroupAccess([5])]
public function listAction(): ResponseInterface
{
//this action is only accessible if the Frontend User has group 3 and 5
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.