incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/3] git commit: [#6677] add comment, and positive test
Date Thu, 13 Feb 2014 17:58:36 GMT
Updated Branches:
  refs/heads/master cab6cfa74 -> 63514760c


[#6677] add comment, and positive test


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/87259aa0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/87259aa0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/87259aa0

Branch: refs/heads/master
Commit: 87259aa02afc635d8f2d41ae88a3a7ace66760df
Parents: 6939145
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Thu Feb 13 17:33:13 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Feb 13 17:33:17 2014 +0000

----------------------------------------------------------------------
 Allura/allura/model/auth.py            | 1 +
 Allura/allura/tests/model/test_auth.py | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87259aa0/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index aa8e5dc..0a68146 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -747,6 +747,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
         if self.is_anonymous():
             return
         roles = g.credentials.user_roles(user_id=self._id)
+        # filter out projects to which the user belongs to no named groups (i.e., role['roles']
is empty)
         projects = [r['project_id'] for r in roles if r['roles']]
         from .project import Project
         return Project.query.find({'_id': {'$in': projects}, 'deleted': False})

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/87259aa0/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index 606b3e2..475b74a 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -20,7 +20,7 @@
 """
 Model tests for auth
 """
-from nose.tools import with_setup, assert_equal, assert_not_in
+from nose.tools import with_setup, assert_equal, assert_not_in, assert_in
 from pylons import tmpl_context as c, app_globals as g
 from webob import Request
 from mock import patch
@@ -268,7 +268,9 @@ def test_user_projects_unnamed():
         user_id=c.user._id,
         project_id=sub1._id)
     ThreadLocalORMSession.flush_all()
-    assert_not_in('test/sub1', [p.shortname for p in c.user.my_projects()])
+    project_names = [p.shortname for p in c.user.my_projects()]
+    assert_not_in('test/sub1', project_names)
+    assert_in('test', project_names)
 
 
 @patch.object(g, 'user_message_max_messages', 3)


Mime
View raw message