public function isAuthorized($user = null) {
switch($this->action) {
case "index":
case "add":
if ($user['role'] == 'coach') {
return true;
}
break;
case "view":
case "edit":
case "delete":
$id = $this->request->params['pass'][0];
$this->User->id = $id;
if ($user['role'] == 'coach' && $this->User->field('client_id') == $user['client_id']) {
return true;
}
break;
}
return parent::isAuthorized($user);
}Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment