allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [03/12] allura git commit: [#8023] ticket:867 changed check user rights
Date Tue, 15 Dec 2015 14:24:35 GMT
[#8023] ticket:867 changed check user rights


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

Branch: refs/heads/ib/8023b
Commit: 2254ed23f9999206b86ff41e771f27a2761fa745
Parents: 514c0de
Author: Denis Kotov <deniskkotov@gmail.com>
Authored: Fri Dec 4 11:09:27 2015 +0200
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Tue Dec 15 13:43:02 2015 +0200

----------------------------------------------------------------------
 Allura/allura/lib/plugin.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2254ed23/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 8b7a282..2daf8ee 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -1318,10 +1318,12 @@ class ThemeProvider(object):
             return None
         if note.user_role is not None and c.user.is_anonymous():
             return None
-        projects = c.user.my_projects_by_role_name(note.user_role)
-        if note.user_role is not None and \
-                projects.count() == 0 or (projects.count() == 1 and projects.first().is_user_project):
-            return None
+        if note.user_role is not None:
+            projects = c.user.my_projects_by_role_name(note.user_role)
+            if projects is not None:
+                only_user_project = projects.count() == 1 and projects.first().is_user_project
+                if projects.count() == 0 or only_user_project:
+                    return None
         cookie = request.cookies.get('site-notification', '').split('-')
         if len(cookie) == 3 and cookie[0] == str(note._id):
             views = asint(cookie[1]) + 1


Mime
View raw message