mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Change syntax for specifying multiple routes for the same action
This commit is contained in:
parent
b706f2f6ab
commit
1bf5b4c240
2 changed files with 12 additions and 16 deletions
|
|
@ -108,22 +108,19 @@ class ModuleActionParser
|
|||
// Parse routes.
|
||||
$route = trim($action['route']);
|
||||
$method = trim($action['method']);
|
||||
$route_vars = [];
|
||||
$route_arg = [];
|
||||
if ($route)
|
||||
{
|
||||
$route_info = self::analyzeRoute($route);
|
||||
$route_vars = $route_info->vars;
|
||||
if ($method)
|
||||
$methods = $method ? explode('|', strtoupper($method)) : (starts_with('proc', $action_name) ? ['POST'] : ['GET']);
|
||||
$routes = explode_with_escape('|', $route);
|
||||
foreach ($routes as $route)
|
||||
{
|
||||
$methods = explode('|', strtoupper($method));
|
||||
}
|
||||
else
|
||||
{
|
||||
$methods = starts_with('proc', $action_name) ? ['POST'] : ['GET'];
|
||||
}
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
$info->route->{$method}[$route_info->regexp] = $action_name;
|
||||
$route_info = self::analyzeRoute($route);
|
||||
$route_arg[$route] = $route_info->vars;
|
||||
foreach ($methods as $method)
|
||||
{
|
||||
$info->route->{$method}[$route_info->regexp] = $action_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,8 +130,7 @@ class ModuleActionParser
|
|||
$action_info->grant = trim($action['grant']) ?: 'guest';
|
||||
$action_info->ruleset = trim($action['ruleset']);
|
||||
$action_info->method = $method;
|
||||
$action_info->route = $route;
|
||||
$action_info->route_vars = $route_vars;
|
||||
$action_info->route = $route_arg;
|
||||
$action_info->standalone = trim($action['standalone']) === 'false' ? 'false' : 'true';
|
||||
$action_info->check_csrf = (trim($action['check_csrf']) ?: trim($action['check-csrf'])) === 'false' ? 'false' : 'true';
|
||||
$action_info->meta_noindex = (trim($action['meta_noindex']) ?: trim($action['meta-noindex'])) === 'true' ? 'true' : 'false';
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
</grants>
|
||||
<actions>
|
||||
<action name="dispBoardContent" type="view" permission="list" standalone="false" index="true" />
|
||||
<action name="dispBoardWrite" type="view" permission="write_document" standalone="false" meta-noindex="true" route="write(/$document_srl)?" />
|
||||
<action name="dispBoardWrite" type="view" permission="write_document" standalone="false" meta-noindex="true" route="write|edit/$document_srl" />
|
||||
<action name="dispBoardDelete" type="view" permission="write_document" standalone="false" meta-noindex="true" route="delete/$document_srl" />
|
||||
<action name="dispBoardWriteComment" type="view" permission="write_comment" standalone="false" meta-noindex="true" route="comment/write/$document_srl" />
|
||||
<action name="dispBoardReplyComment" type="view" permission="write_comment" standalone="false" meta-noindex="true" route="comment/reply/$comment_srl"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue