diff options
Diffstat (limited to 'app/Helper/UserHelper.php')
-rw-r--r-- | app/Helper/UserHelper.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/Helper/UserHelper.php b/app/Helper/UserHelper.php index ae3efe1d..e42bafe4 100644 --- a/app/Helper/UserHelper.php +++ b/app/Helper/UserHelper.php @@ -50,7 +50,8 @@ class UserHelper extends Base */ public function getFullname(array $user = array()) { - return $this->userModel->getFullname(empty($user) ? $this->userSession->getAll() : $user); + $user = empty($user) ? $this->userSession->getAll() : $user; + return $user['name'] ?: $user['username']; } /** @@ -107,6 +108,10 @@ class UserHelper extends Base */ public function hasAccess($controller, $action) { + if (! $this->userSession->isLogged()) { + return false; + } + $key = 'app_access:'.$controller.$action; $result = $this->memoryCache->get($key); @@ -128,6 +133,10 @@ class UserHelper extends Base */ public function hasProjectAccess($controller, $action, $project_id) { + if (! $this->userSession->isLogged()) { + return false; + } + if ($this->userSession->isAdmin()) { return true; } |