Search code examples
phplithium

Role Authentication in Lithium PHP


I understand how to check if a user exists and log them in, but I need to check what role they play (admin or client) I know to use:

if (!Auth::check('default')) { return $this->redirect('/'); }

but how would I append that to check role?


Solution

  • Li3 only handles authentication directly in the core. For the counterpart responsibility of authorization, you need a library like li3_access. See the README for a breakdown of different possible configurations.