bjyoungblood / BjyAuthorize

MIT License
276 stars 161 forks source link

suggestion for Route Guard #151

Closed gondo closed 6 years ago

gondo commented 11 years ago

it would be nice to be able to set wildcard route rule such as:

array('route' => 'zfcuser/*', 'roles' => array('guest', 'user')),

as currently (v 1.3.0) Controller guard is broken (more info in #150 ) and i have to list all 7 rules purely for zfcuser:

array('route' => 'zfcuser', 'roles' => array('guest', 'user')),
array('route' => 'zfcuser/login', 'roles' => array('guest', 'user')),
array('route' => 'zfcuser/authenticate', 'roles' => array('guest', 'user')),
array('route' => 'zfcuser/logout', 'roles' => array('guest', 'user')),
array('route' => 'zfcuser/register', 'roles' => array('guest', 'user')),
array('route' => 'zfcuser/changepassword', 'roles' => array('guest', 'user')),
array('route' => 'zfcuser/changeemail', 'roles' => array('guest', 'user')),
Perfect-Web commented 11 years ago

+1 to that

sebz1504 commented 10 years ago

+1 to that too

fernandomantoan commented 10 years ago

+1

Jigsaw5279 commented 10 years ago

+1

Ocramius commented 10 years ago

This is not possible in ACL logic.

It would require creating a new provider that receives the route config as a dependency, and then iterates over existing route names and populates the rules with those names matching the given wildcard-ish strings.

If anyone wants to give this a try, go on :)