diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-12-31 12:37:15 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-12-31 12:37:15 -0500 |
commit | 772804add8095eea9b3ec2a832c2f82fbb9a6fd5 (patch) | |
tree | 782a414d15f9091d04bcf3960a957f952958e548 /app/Model/User.php | |
parent | 66f150d887a34d2b51ff14f22d0fd41a34f8cc77 (diff) |
Acl refactoring
Diffstat (limited to 'app/Model/User.php')
-rw-r--r-- | app/Model/User.php | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/app/Model/User.php b/app/Model/User.php index 3754b918..78d44b47 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -48,46 +48,11 @@ class User extends Base */ public function isAdmin($user_id) { - $result = $this->db + return $this->db ->table(User::TABLE) ->eq('id', $user_id) ->eq('is_admin', 1) - ->count(); - - return $result > 0; - } - - /** - * Get the default project from the session - * - * @access public - * @return integer - */ - public function getFavoriteProjectId() - { - return isset($this->session['user']['default_project_id']) ? $this->session['user']['default_project_id'] : 0; - } - - /** - * Get the last seen project from the session - * - * @access public - * @return integer - */ - public function getLastSeenProjectId() - { - return empty($this->session['last_show_project_id']) ? 0 : $this->session['last_show_project_id']; - } - - /** - * Set the last seen project from the session - * - * @access public - * @@param integer $project_id Project id - */ - public function storeLastSeenProjectId($project_id) - { - $this->session['last_show_project_id'] = (int) $project_id; + ->count() === 1; } /** @@ -287,7 +252,7 @@ class User extends Base $result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($values); // If the user is connected refresh his session - if (Session::isOpen() && $this->acl->getUserId() == $values['id']) { + if (Session::isOpen() && $this->userSession->getId() == $values['id']) { $this->updateSession(); } @@ -337,7 +302,7 @@ class User extends Base public function updateSession(array $user = array()) { if (empty($user)) { - $user = $this->getById($this->acl->getUserId()); + $user = $this->getById($this->userSession->getId()); } if (isset($user['password'])) { |