Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1165)

Side by Side Diff: appengine/components/components/ereporter2/acl.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Fixed third parties Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The LUCI Authors. All rights reserved. 1 # Copyright 2014 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Access control groups for ereporter2.""" 5 """Access control groups for ereporter2."""
6 6
7 from components import auth 7 from components import auth
8 from . import config 8 from . import config
9 9
10 10
11 RECIPIENTS_AUTH_GROUP = config.config.RECIPIENTS_AUTH_GROUP 11 RECIPIENTS_AUTH_GROUP = config.config.RECIPIENTS_AUTH_GROUP
12 VIEWERS_AUTH_GROUP = config.config.VIEWERS_AUTH_GROUP 12 VIEWERS_AUTH_GROUP = config.config.VIEWERS_AUTH_GROUP
13 13
14 14
15 def get_ereporter2_recipients(): 15 def get_ereporter2_recipients():
16 """Returns list of emails to send reports to.""" 16 """Returns list of emails to send reports to."""
17 return [x.name for x in auth.list_group(RECIPIENTS_AUTH_GROUP) if x.is_user] 17 return [x.name for x in auth.list_group(RECIPIENTS_AUTH_GROUP) if x.is_user]
18 18
19 19
20 def is_ereporter2_viewer(): 20 def is_ereporter2_viewer():
21 """True if current user is in recipients list, viewer list or is an admin.""" 21 """True if current user is in recipients list, viewer list or is an admin."""
22 if auth.is_admin() or auth.is_group_member(VIEWERS_AUTH_GROUP): 22 if auth.is_admin() or auth.is_group_member(VIEWERS_AUTH_GROUP):
23 return True 23 return True
24 ident = auth.get_current_identity() 24 ident = auth.get_current_identity()
25 return ident.is_user and ident.name in get_ereporter2_recipients() 25 return ident.is_user and ident.name in get_ereporter2_recipients()
26 26
27 27
28 def is_ereporter2_editor(): 28 def is_ereporter2_editor():
29 """Only auth admins or recipients can edit the silencing filters.""" 29 """Only auth admins or recipients can edit the silencing filters."""
30 return auth.is_admin() or auth.is_group_member(RECIPIENTS_AUTH_GROUP) 30 return auth.is_admin() or auth.is_group_member(RECIPIENTS_AUTH_GROUP)
OLDNEW
« no previous file with comments | « appengine/components/components/ereporter2/__init__.py ('k') | appengine/components/components/ereporter2/config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698