$f3 = Base::instance();
$access=Access::instance();
$access->deny('/test');// deny all access to /test
$access->allow('/test','admin');// except "admin"
$f3->route('GET|POST|DELETE /login',function() {
// handle authentication here (login/logout form)
// authenticated user gets stored in SESSION.user
});
$f3->route('GET /test',function() use($access) {
$access->authorize($f3->get('SESSION.user'));// throws a 403 error if SESSION.user is not "admin"
echo 'hello from f3!';
});
$f3->run();
class myController {
function get($f3) {
echo 'hello from f3';
}
function beforeRoute($f3) {
$access=Access::instance();
$access->authorize($f3->get('SESSION.user'));
}
}
$f3->route('GET /test',function() use($access) { // the use($access)
$access->authorize($f3->get('SESSION.user')); // making use of $access
anyway i can now see how to use it so on my way :)
//then in routes.ini
GET /adduser=admin->adduser
//in class admin :
function beforeRoute($f3)
{
$f3=Base::instance();
$access =Access::instance();
$access->authorize($f3->get('SESSION.role'));
if the url is : http://localhost:3000/adduser
access plugin works & access is denied if session.role is not set
however if the url is : http://localhost:3000/addUser
//ie one or more letters is different case, the function adduser of class admin i.e admin->adduser is evoked even if SESSION.role is not set?
I just used $f3->set('CASELESS',FALSE); to get around this
--
-- 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/d7919b57-54fd-4748-a02e-c7811de18836%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.