Answer the question
In order to leave comments, you need to log in
How can one make a single request without a loop?
Is it possible to query all user roles at once without a loop?
foreach ($this->roles as $role) {
$access = (ORM::factory('Role', $role)
->permission
->where_open()
->where('directory', '=', $this->request->directory())
->or_where('directory', '=', '')
->or_where('directory', 'is', NULL)
->where_close()
->and_where_open()
->where('controller', '=', $this->request->controller())
->or_where('controller', '=', '')
->or_where('controller', 'is', NULL)
->and_where_close()
->and_where_open()
->where('action', '=', $this->request->action())
->or_where('action', '=', '')
->or_where('action', 'is', NULL)
->and_where_close()
->count_all() > 0);
if ($access)
break;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question