CodeIgniter Forums
Myth-Auth Role filter parameter issues - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Myth-Auth Role filter parameter issues (/showthread.php?tid=76183)



Myth-Auth Role filter parameter issues - midhunlalkc - 04-20-2020

Hi,
i am using myth-auth in My application that have both frontend and backend users.

backend user groups:  owner, admin, customer_support
frontend user groups:  customer

i want all the loggedIn backend users to pass through the below filter.

in app/Config/Filters when i use filter parameters like below
Code:
public filters = [
    'role:owner,admin,customer_support' => ['before' => ['admin/*']],
];

am getting  the following error.

role:owner,admin,customer_support filter must have a matching alias defined.

So how can i achieve this?


RE: Myth-Auth Role filter parameter issues - Gary - 04-20-2020

I'd suggest having everything redirect to your custom filter code, which is responsible for the role check, and handles each accordingly... it would probably simply return for this "super-user" group, and redirect other users to a "have a nice life" page.


RE: Myth-Auth Role filter parameter issues - midhunlalkc - 04-20-2020

(04-20-2020, 04:28 AM)Gary Wrote: I'd suggest having everything redirect to your custom filter code, which is responsible for the role check, and handles each accordingly... it would probably simply return for this "super-user" group, and redirect other users to a "have a nice life" page.

I have another issue also;

$routes->group('admin', ['filter' => 'login'], function($routes){

        $routes->group('catalog', [ 'namespace' => 'Modules\Catalog\Controllers' ], function($routes){

              $routes->group('products', function($routes){
                             $routes->add('/', 'Products::productList', ['as' => 'product-list' ]);
              });
       });
});

when am using route groups like this , the filter is not working on the top group. 
what may be the issue?