ZF-Commons / zfc-rbac

Role-based access control module to provide additional features on top of Zend\Permissions\Rbac
BSD 3-Clause "New" or "Revised" License
181 stars 111 forks source link

Append previous Uri when user is connected only #222

Closed webdevilopers closed 10 years ago

webdevilopers commented 10 years ago

I am logged in with the role user who has access to the home route. There is an admin route that is only available for the role admin. When I try to access the admin route I am redirected - as configured - to my home route which results in the following address: http://localhost:8000/?redirectTo=http://localhost:8000/admin

Since there is no action to take - no "become an admin" feature - the redirectTo parameter is not neccessary.

Should it be only added like stated in the parameter config description: Set the route to redirect when user is connected and ONLY then?

davidwindell commented 10 years ago

No, because the purpose is to redirect the user to the page they wanted after logging in.

bakura10 commented 10 years ago

You may now use the new version that include a redirect_when_connected param, to show the 403 page instead of redirection when connected.

webdevilopers commented 10 years ago

But using the _redirect_whenconnected does not change my described behaviour, right?

If a user is logged in / connected as user and he tries to access a route that needs a different role i.e. admin he is redirected and the redirectTo param is added to the url. Though the url maybe is just the home page with no further login form - since the user is already logged in - and no become admin feature. The redirectTo param is simpy not neccessary then.

Since this isn't a real issue you may ignore it.

BTW: Do I have to extra register the error/403 route or / and copy the file to my view folder? For some reason it's not found by simply adding the ZfcRbac module though the file can be found under zfc-rbac/view/error/403.phtml.

zfc-rbac/config/module.config.php l. 61 ff.:

    'view_manager' => [
        'template_map' => [
            'error/403'                             => __DIR__ . '/../view/error/403.phtml',
            'zend-developer-tools/toolbar/zfc-rbac' => __DIR__ . '/../view/zend-developer-tools/toolbar/zfc-rbac.phtml'
        ]
    ],