Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8944593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:03:49+00:00 2026-06-15T12:03:49+00:00

My Mojolicious application has some custom authentication mechanism, which I implement in a routing

  • 0

My Mojolicious application has some custom authentication mechanism, which I implement in a routing condition called auth_permission:

$app->add_condition(auth_permission => sub {
    return is_user_allowed(...) ? 1 : 0;
});

So my routes look something like this:

my $r = $app->routes;

$r->get('/prefs')
    # no permission necessary here
  ->to(...);

$r->get('/objects')
  ->over(auth_permission => 'view objects')
  ->to(...);

$r->get('/objects/delete/:id')
  ->over(auth_permission => 'delete objects')
  ->to(...);

The to() clauses are handled correctly: GET /objects gives me the object list, and GET /objects/delete/42 deletes object 42.

The problem is that the permission view objects is checked for both requests, even though the second route should check the permission delete objects.

The reason seems to be that /objects/delete/42 is a path below /objects. The same problem does not occur with the route /prefs, which does not have a common base with the other routes.

My current workaround is to place the rule for /objects below the one for /objects/delete/:id, but that’s a) unelegant and is b) going to break when another developer edits the file. Can I explicitly disable the nesting behavior seen in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:03:51+00:00Added an answer on June 15, 2026 at 12:03 pm

    The Mojolicious docs seem to indicate that you should be building the extended route off the object that handles the shorter one. See the Nested Routes Section of the docs.

    This means you have a $objects route, and a $objects_delete route derived from it. Eliminates ordering problems (other than having to declare the shorter route first).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the mojolicious framework to write Web-App. Mojo::Base has a nice feature to
I have some Mojolicious-based apps which happily run under Apache2 with mod_cgi and mod_fastcgi.
I have the following code in my Mojolicious application module. When I run this
I'm using jQuery to get some data from a Mojolicious::Lite API I'm building. But
I have an application that uses the Mojolicious framework. I have a table in
The mojolicious application that I use is JSON based, that is the interaction between
I am currently working on a Mojolicious app using TDD on my Mac and
I'm attempting to create a small ORM library for use in a Mojolicious web-application.
I am creating test cases for my app developed using Mojolicious framework. I am
In a Mojolicious app I have a route in my Controller code like the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.