diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-01-04 22:34:59 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-01-04 22:34:59 -0500 |
commit | 99d27e0ce4f48454808d2325cb407b5b35cf5e88 (patch) | |
tree | 3c518cf08499890d46b9d2f65724d46617e1fc67 /app/Model/UserSession.php | |
parent | d1d04d6feeebeba2aea5333d7a4229fcec799f75 (diff) |
Allow users to override the timezone and the language
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 |