Skip to content
This repository has been archived by the owner on May 14, 2018. It is now read-only.

No Segment Routes #87

Closed
darkmatus opened this issue Feb 20, 2013 · 11 comments
Closed

No Segment Routes #87

darkmatus opened this issue Feb 20, 2013 · 11 comments

Comments

@darkmatus
Copy link

Every time I want to access an route defined with type segment
I get an 403 error.
At this time it's not to bad for me because im in develeopment but
later I need it working with iteral and segment.

@Ocramius
Copy link
Contributor

@darkmatus please expose relevant configuration.

@darkmatus
Copy link
Author

/* some Code */
        'router' => array(
            'routes' => array(
                'profile' => array(
                    'type' => 'Segment',
                    'options' => array(
                        'route' => '/profile/[:action/[:id]]',
                        'defaults' => array(
                            'controller' => 'profile',
                            'action'     => 'index',
                        ),
                    ),
                ),
/*  more routes here */

The route above solves every time in an 403.
All Iteral routes from other modules working fine.
For Example

'router' => array(
        'routes' => array(
            'home' => array(
                'type'    => 'Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'news',
                        'action'     => 'index',
                    )
                )

@Ocramius
Copy link
Contributor

And what is the bjy-authorize config associated to those? Are you eventually able to get the detailed exception (if any is thrown)?

@darkmatus
Copy link
Author

I get no Exception only the 403 Forbidden

You are not authorized to access Forum\Controller\Forum ::indexAction() .
The module.bjyauthorize.global.php looks (partial) like this:

        'guards' => array(
            'BjyAuthorize\Guard\Controller' => array(
                array('controller' => 'zfcuser', 'roles' => array()),
                array('controller' => 'profile', 'roles' => array('user')),
                array('controller' => 'news', 'roles' => array()),
                array('controller' => 'news_admin', 'roles' => array('admin')),
                array('controller' => 'admin', 'roles' => array('admin')),
                array('controller' => 'forum', 'roles' => array('user', 'admin')),
                array('controller' => 'Application\Controller\Index', 'roles' => array('guest', 'user')),
            ),
           'BjyAuthorize\Guard\Route' => array(
                array('route' => 'zfcuser', 'roles' => array('user')),
                array('route' => 'zfcuser/logout', 'roles' => array('user')),
                array('route' => 'zfcuser/changepassword', 'roles' => array('user')),
                array('route' => 'zfcuser/changeemail', 'roles' => array('user')),
                array('route' => 'zfcuser/login', 'roles' => array('guest')),
                array('route' => 'zfcuser/register', 'roles' => array('guest')),
                array('route' => 'profile', 'roles' => array('user')),
                array('route' => 'news', 'roles' => array()),
                array('route' => 'home/admin', 'roles' => array('admin')),
                array('route' => 'admin/', 'roles' => array('admin')),
                array('route' => 'show', 'roles' => array('user')),
                array('route' => 'forum', 'roles' => array('user', 'admin')),
                array('route' => 'home', 'roles' => array('guest', 'user')),

@Ocramius
Copy link
Contributor

Looks like you have configured the controller guard incorrectly then. This has nothing to do with routing

@darkmatus
Copy link
Author

But when I rewrite my routings from Segment into Iteral all works fine.

@Ocramius
Copy link
Contributor

@darkmatus that's probably because the matched controller changes. Disable bjy for some time and provide a dump of the RouteMatch object in both cases.

@Ocramius
Copy link
Contributor

Sidenote: firewalling both routes and controllers is useless.. Consider firewalling only your controllers.

@darkmatus
Copy link
Author

Ok, diabling the controller guard works fine. But disablingthe route guard solves in an 403. Haven't testet the RouteMatching yet.

@Ocramius
Copy link
Contributor

I simply suggest not to use the route guard ;)
On 22 Feb 2013 08:02, "darkmatus" notifications@github.com wrote:

Ok, diabling the controller guard works fine. But disablingthe route guard
solves in an 403. Haven't testet the RouteMatching yet.


Reply to this email directly or view it on GitHubhttps://github.com//issues/87#issuecomment-13931271.

@Ocramius
Copy link
Contributor

Closing as non-issue (more like a help request)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants