Hi, as in subject, can I have same named routing for more url? Like that:
$this->AddRoute('GET @admin: /admin', __NAMESPACE__ . '\Pages->Admin');
$this->AddRoute('GET @admin: /admin/eslstatus', __NAMESPACE__ . '\Pages->ESLStatus');
My target is to use alias to define the ACL of every page.--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at https://groups.google.com/group/f3-framework.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/4a90ca87-72cc-4163-9eee-445db7a55e58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
$currentAlias = $f3->get('ALIAS');
if ( $currentAlias == 'admin' ) render page...;
else reroute('/');
and my first question is if I can use @namedroutes to specify my roles of ACL.
My logic is a bit complex.
Why don’t you group the various method in a controller class (or classes), and in that class (or in the base class) do your check in beforeRoute(), which can reroute to ‘/’ if needed?
class MyController {
public function beforeRoute($f3, $args) {
// Do some check in here - you could split $f3->get('PATH') or $args[0] if needed and use the first portion
if ($myACLCheckFailed) {
$f3->reroute('/');
}
}
public function adminHandler($f3, $args) {
// ACL has already been checked....
}
};