You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/12/08 12:32:37 UTC
[3/9] allura git commit: [#8023] ticket:867 changed check user rights
[#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/1eb1850b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/1eb1850b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/1eb1850b
Branch: refs/heads/ib/8023a
Commit: 1eb1850bde4584312be1d4c5a8b8f038d5fc95ae
Parents: 885edc1
Author: Denis Kotov <de...@gmail.com>
Authored: Fri Dec 4 11:09:27 2015 +0200
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Dec 7 10:28:26 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/1eb1850b/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