Welcome Guest, Not a member yet? Register   Sign In
Myth Auth LoginFilter Problem
#4

Did you add all the settings to the files?

Restrict routes based on their URI pattern by editing app/Config/Filters.php and adding them to the $filters array, e.g.:

PHP Code:
public filters = [
    'login' => ['before' => ['account/*']],
]; 

Or restrict your entire site by adding the LoginFilter to the $globals array:

PHP Code:
    public $globals = [
        'before' => [
            'honeypot',
            'login'

Restricting a single route

Any single route can be restricted by adding the filter option to the last parameter in any of the route definition methods:


PHP Code:
$routes->get('admin/users''UserController::index', ['filter' => 'permission:manage-user'])
$routes->get('admin/users''UserController::index', ['filter' => 'role:admin,superadmin']) 

The filter can be either role or permission, which restricts the route by either group or permission.
You must add a comma-separated list of groups or permissions to check the logged in user against.

Restricting Route Groups

In the same way, entire groups of routes can be restricted within the group() method:


PHP Code:
$routes->group('admin', ['filter' => 'role:admin,superadmin'], function($routes) {
    ...
}); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Myth Auth LoginFilter Problem - by ralphcabanero - 09-13-2020, 07:49 AM
RE: Myth Auth LoginFilter Problem - by InsiteFX - 09-13-2020, 08:19 AM
RE: Myth Auth LoginFilter Problem - by InsiteFX - 09-13-2020, 03:46 PM
RE: Myth Auth LoginFilter Problem - by raajaud - 12-01-2020, 08:10 PM
RE: Myth Auth LoginFilter Problem - by PwrSrg - 01-04-2021, 05:02 PM
RE: Myth Auth LoginFilter Problem - by InsiteFX - 09-14-2020, 08:47 AM
RE: Myth Auth LoginFilter Problem - by InsiteFX - 09-15-2020, 08:36 AM
RE: Myth Auth LoginFilter Problem - by InsiteFX - 12-02-2020, 11:06 AM
RE: Myth Auth LoginFilter Problem - by PwrSrg - 01-06-2021, 06:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB