diff options
Diffstat (limited to 'app/Model/UserSession.php')
-rw-r--r-- | app/Model/UserSession.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/Model/UserSession.php b/app/Model/UserSession.php index c27b3743..6d9a2ebc 100644 --- a/app/Model/UserSession.php +++ b/app/Model/UserSession.php @@ -2,6 +2,8 @@ namespace Model; +use Core\Translator; + /** * User Session * @@ -11,6 +13,30 @@ namespace Model; class UserSession extends Base { /** + * Update user session information + * + * @access public + * @param array $user User data + */ + public function refresh(array $user = array()) + { + if (empty($user)) { + $user = $this->user->getById($this->userSession->getId()); + } + + if (isset($user['password'])) { + unset($user['password']); + } + + $user['id'] = (int) $user['id']; + $user['default_project_id'] = (int) $user['default_project_id']; + $user['is_admin'] = (bool) $user['is_admin']; + $user['is_ldap_user'] = (bool) $user['is_ldap_user']; + + $this->session['user'] = $user; + } + + /** * Return true if the logged user is admin * * @access public |