Checking User Roles before routing in a systematic way

42 views
Skip to first unread message

solo

unread,
Mar 5, 2017, 2:20:00 PM3/5/17
to Fat-Free Framework
Hi all, 

I am wanting to implement a single beforeroute() chunk of code that validates what page the user is on, and checks for the proper "role" before proceeding.  However, I haven't come up with any good way to do so in a systematic way, and am wondering if anyone else can share what they typically do?

Some other frameworks have route filtering but it doesn't look like that's available in F3: https://stackoverflow.com/questions/20794225/laravel-route-filter-to-check-user-roles for example.

Right now I am checking role at my base controller, and inside any controllers that require more strict access I have another beforeroute() function that supercedes the extended base controller, so that I can check for access there separately.  It doesn't feel like the cleanest method, but gets the job done.

Thanks!

Anatol

unread,
Mar 5, 2017, 4:12:59 PM3/5/17
to Fat-Free Framework
Hi,

Have a Look at xfra s auth Plugin. It Support roles.

https://github.com/xfra35/f3-access

Cheers

Anatol

Reply all
Reply to author
Forward
0 new messages