developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

#684 closed bug (invalid)

jUrl: current entry point is not used

Reported by: Julien Owned by: Julien
Priority: high Milestone:
Component: jelix:plugins Version: 1.0.5
Severity: major Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

With simple Url engine, I have made the following tests :

created a new app, and in the default action wrote :

$rep->body->assign('MAIN', jUrl::get('index'));

then called the action with index.php and got :

/~julien/jelix/bla/www/index.php?module=bla&action=default:index

which is OK

The I duplicated index.php to index2.php, and called the action with index2.php. I still got :

/~julien/jelix/bla/www/index.php?module=bla&action=default:index

which is not OK, because the current entry point should be used as it is written is the doc : see first sentence here or here for french version.

I made a patch that uses the current entry point, but still scans entrypoints rules in the config file. The match for a rule based only on request type applies only if the current request type is different from the asked request type : current request is @classic and I want an URL for XML-RPC.

Attachments (1)

684-jUrl-current-entry-point-is-not-used.diff (2.6 KB) - added by Julien 12 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 12 years ago by Julien

  • Owner set to Julien
  • Status changed from new to assigned

comment:2 Changed 12 years ago by laurentj

This is the documentation which needs to be completed. There is no bugs in the implementation.

If an action should be executed by another entry point than the default entry point, so you should declare it in the simple_urlengine_entrypoints section of the configuration.

An action is always associated to a unique entry point in the application.

For me, this bug is invalid.

comment:3 Changed 12 years ago by Julien

The problem can occur when an action can be called from multiple entrypoints. An example is jAuth module.

We could have 2 entrypoints (admin.php and extranet.php) with 2 differents configs for jAuth : admin uses an ldap server for co-workers accounts and extranet uses a dao for our clients.

we then have 2 login forms, both calling jauth controller's actions.

Connection with jAuth controller must keep the current entrypoint to have the right config params.

And it is a non-sense to declare the action jauth~auth:login for example for both entry points, as it will keep the last (or first, don't remember the code) declaration only.

I think that changing entry point must be specified explicitly.

So my patch does the following :

always keep the current entry point, unless exceptions are declared in the simple_urlengine_entrypoints section

by the way, keeping the current entrypoint may also allow to access the application in several environments and configurations ( db connections, themes, even jelix versions, ... )

comment:4 Changed 12 years ago by laurentj

  • review changed from review? to review-

And it is a non-sense to declare the action jauth~auth:login for example for both entry points, as it will keep the last (or first, don't remember the code) declaration only.

Yes, that's a non-sense. But if you have a different urls mapping (and this is your case) between two entry points, then you have explicitely two applications.

So you should have two differents configuration file. So two differents simple_urlengine_entrypoints sections.

However, it's easy. Remember, you can have a specific configuration file for each entry points, so in each configuration file, you can redefine all parameters from defaultconfig.ini.php.

So for admin.php, you can have in admin/config.ini.php

[simple_urlengine_entrypoints]
admin = "@classic"
extranet = "specificmodule1~*@classic specificmodule2~*@classic"

and for extranet.php in extranet/config.ini.php:

[simple_urlengine_entrypoints]
admin = "specificmodule5~*@classic specificmodule4~*@classic"
extranet = "@classic"

I think that changing entry point must be specified explicitly.

Well, this is the current behavior :

[simple_urlengine_entrypoints]
; all action are belongs to admin
admin = "@classic"
; except actions from specificmodule1 and specificmodule2  <-- explicit
extranet = "specificmodule1~*@classic specificmodule2~*@classic"

For me, getting the current entrypoint as the default entrypoint for urls is an open door for many problems IMHO, because it is difficult to predict the resulting url given by jUrl::get.

comment:5 follow-up: Changed 12 years ago by Julien

Hello,

redifining the config in each entry point is a good solution, you're right.

So Ok, this ticket may be marked as won't fix, but we should update the doc, because it says that the current entry point is used by default, and in fact it's the default one which is used.

comment:6 in reply to: ↑ 5 Changed 12 years ago by Julien

Replying to Julien:

redifining the config

redefining I mean

I don't know why Trac doesn't have an edit feature ;)

comment:7 Changed 12 years ago by laurentj

  • Resolution set to invalid
  • review review- deleted
  • Status changed from assigned to closed

Ok, good :-)

Note: See TracTickets for help on using tickets.