From bcd515eed5d9fc3e2267ba0260a5dc7b41bed82a Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Fri, 11 May 2012 23:25:06 +0200 Subject: [PATCH] =?UTF-8?q?Do=20not=20display=20all=20project=20to=20a=20u?= =?UTF-8?q?ser=20if=20he=20has=20no=20rights=20for=20=5Fany=5F=20project?= =?UTF-8?q?=20of=20the=20forge,=20but=20actually=20hide=20all...=20thanks?= =?UTF-8?q?=20to=20Ren=C3=A9=20Klomp=20for=20this=20finding!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NEWS.mdtext | 9 +++++++++ src/IDF/Views.php | 12 ++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/NEWS.mdtext b/NEWS.mdtext index 93e687c..4d37b1f 100644 --- a/NEWS.mdtext +++ b/NEWS.mdtext @@ -1,3 +1,12 @@ +# InDefero 1.3.3 - xxx xxx xx xx:xx 2012 UTC + +## Bugfixes + +- If an anonymous or authenticated user had no access + to any project in a forge, all projects were listed + for him (but still no one was actually accessible). + This has been fixed. + # InDefero 1.3.2 - Wed May 09 20:05 2012 UTC ## Bugfixes diff --git a/src/IDF/Views.php b/src/IDF/Views.php index bcc1492..b56cb5f 100644 --- a/src/IDF/Views.php +++ b/src/IDF/Views.php @@ -443,10 +443,12 @@ class IDF_Views } $projectIds = self::getUserVisibleProjectIds($user); - if (count($projectIds) > 0) { - $sql->SAnd(new Pluf_SQL(sprintf($db->pfx.'idf_projects.id IN (%s)', implode(', ', $projectIds)))); + if (count($projectIds) == 0) { + return new ArrayObject(); } + $sql->SAnd(new Pluf_SQL(sprintf($db->pfx.'idf_projects.id IN (%s)', implode(', ', $projectIds)))); + $orderTypes = array( 'name' => 'name ASC', 'activity' => 'value DESC, name ASC', @@ -470,10 +472,12 @@ class IDF_Views $sql = new Pluf_SQL('project IS NULL'); $projectIds = self::getUserVisibleProjectIds($user); - if (count($projectIds) > 0) { - $sql->SAnd(new Pluf_SQL(sprintf('idf_project_id IN (%s)', implode(', ', $projectIds)))); + if (count($projectIds) == 0) { + return new ArrayObject(); } + $sql->SAnd(new Pluf_SQL(sprintf('idf_project_id IN (%s)', implode(', ', $projectIds)))); + $tagList = Pluf::factory('IDF_Tag')->getList(array( 'filter' => $sql->gen(), 'view' => 'join_projects',