From 109a2a2e25e0e170d3df3860d054f82f70e78c4d Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 1 Jul 2015 17:36:21 -0400 Subject: Change dashboard --- app/Controller/Base.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'app/Controller/Base.php') 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; + } } -- cgit v1.2.3