• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controller Filters - Input needed

#20
My thoughts, while still forming, are:

1) Yes, that's how I pictured it, though there might be some syntax options that could make that more palatable.

2) $routes array is probably bettern named $uri - since it would be the input url. This makes it simple to modify the underlying guts of the site, while still keeping things intact, as long as the URI structure doesn't change.

3) I had that thought, also, and haven't explored it much yet, but it seemed easier to keep a mental picture of what was affecting a portion of the site by grouping them by uri. Instead of checking 3 or 4 arrays to make sure that the admin area had everything applied to it, etc. I guess using your example, it would be something like this, then:

Code:
public $filters = [

    'isLoggedIn'    => ['admin/*', 'profiles/*', 'users/*', 'posts/*/store', 'posts/*/destroy'],
    'somethignElse' => ['admin/*', 'profiles/*', 'users/*', 'posts/*/store', 'posts/*/destroy'],
];

In some ways this is definitely cleaner, but I can't help but think that once a site gets big enough, it's going to be confusing to keep in mind what's being protected either way. The first way (with some additional syntax for grouping routes, or something) makes it easier to look at a portion of your site and make sure it has all of the filters applied it needs, to me anyway.

I'll have to make a list of general types of filters that we'd expect to be used and see which way would be easiest for each of them to be applied.
Support Development  • Practical CodeIgniter 3  •
Myth:AuthVulcan - CLI Tools for CI4
Reply


Messages In This Thread
Controller Filters - Input needed - by kilishan - 07-07-2016, 08:39 PM
RE: Controller Filters - Input needed - by arma7x - 07-10-2016, 06:46 AM
RE: Controller Filters - Input needed - by arma7x - 07-07-2016, 09:14 PM
RE: Controller Filters - Input needed - by kilishan - 07-10-2016, 10:46 PM
RE: Controller Filters - Input needed - by arma7x - 07-10-2016, 11:42 PM
RE: Controller Filters - Input needed - by arma7x - 07-12-2016, 01:55 AM
RE: Controller Filters - Input needed - by arma7x - 07-13-2016, 12:23 AM
RE: Controller Filters - Input needed - by arma7x - 07-14-2016, 12:37 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.