From 875f2f754b0f5cc320273a005e9ae15d98381046 Mon Sep 17 00:00:00 2001 From: Eike Foken Date: Fri, 16 Sep 2011 15:16:03 +0200 Subject: [PATCH 1/2] Show only accessible projects in header selection --- application/views/header.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/views/header.php b/application/views/header.php index 212d214..ebc86a6 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -51,7 +51,12 @@ project->getAll() as $project): + if ($this->access->isAdmin()) { + $theProjects = $this->project->getAll(); + } else { + $theProjects = $this->project->getAccessible(); + } + foreach ($theProjects as $project): ?> Date: Fri, 16 Sep 2011 15:18:05 +0200 Subject: [PATCH 2/2] Fix getAccessible() in project model --- application/models/project.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/models/project.php b/application/models/project.php index e6636ce..a2d7d3e 100644 --- a/application/models/project.php +++ b/application/models/project.php @@ -98,7 +98,11 @@ class Project extends CI_Model { * @param string $userId * @return array All accessible projects */ - public function getAccessible($userId) { + public function getAccessible($userId = '') { + if (empty($userId)) { + $userId = $this->session->userdata('user_id'); + } + $shares = array(); $query = $this->db->get_where('shares', array('user_id' => $userId)); foreach ($query->result_array() as $share) {