Im trying to pass a condition to my UserController in order to view certain Users whose Role matches to the page I'm trying to access.
For example:
/admin => User.admin
/student => User.student
I'm able to retrieve a list of all registered students using the find('all') function, but when I try to filter roles through setting conditions I'm getting an error that references my code and the role I'm trying to retrieve.
Here's my function in my controller:
public function index($role="admin") {
//debug($role);
$this->User->recursive = 0;
$this->request->data('users', $this->User->find('all',
array('conditions' => 'User.role')));
$this->set('users', $this->paginate());
}
Any tips?