diff options
Diffstat (limited to 'app/Controller/Base.php')
-rw-r--r-- | app/Controller/Base.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php index cab70c6b..b7ee431f 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -306,4 +306,25 @@ abstract class Base extends \Core\Base return $project; } + + /** + * Common method to get the user + * + * @access protected + * @return array + */ + protected function getUser() + { + $user = $this->user->getById($this->request->getIntegerParam('user_id', $this->userSession->getId())); + + if (empty($user)) { + $this->notfound(); + } + + if (! $this->userSession->isAdmin() && $this->userSession->getId() != $user['id']) { + $this->forbidden(); + } + + return $user; + } } |