CodeIgniter Forums
Filters except parameter (not for globals only) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Filters except parameter (not for globals only) (/showthread.php?tid=86692)



Filters except parameter (not for globals only) - xbotkaj - 02-12-2023

Hello guys, 
I would like to request to add "except" parameters for Filters. We currently have this option to not apply filters for specific paths only for global filters. However, this feature is very useful for modules. When you define routes with group segment and you want to apply a filter to all groups except one or two paths without touching the main filters config.

Scenario:
Imagine you have a main front end that does not use authentication, then you add a code module that has authentication of it its own. So you want to restrict all paths to the code module except login.
So this would be a handy feature like for the globals:
PHP Code:
<?php

namespace Config;

use 
CodeIgniter\Config\BaseConfig;

class 
Filters extends BaseConfig
{
    public $globals = [
        'before' => [
            'csrf' => ['except' => ['foo/*''bar/*']],
        ],
        'after' => [],
    ];

    // ...


Thanks