Set up some basic security things, including the root_factory (ACLFactory).
[xonotic/xonstat.git] / xonstat / security.py
1 from pyramid.security import Allow, Everyone
2
3 USERS = {
4     'admin':'admin',
5     'viewer':'viewer',
6 }
7
8 GROUPS = {
9     'admin':['group:admins'],
10 }
11
12 # default ACL
13 class ACLFactory(object):
14     __acl__ = [
15         (Allow, Everyone, 'view'),
16         (Allow, 'group:admins', 'merge')
17     ]
18     def __init__(self, request):
19         pass
20
21
22 def groupfinder(userid, request):
23     print('userid is %s' % userid)
24     if userid in USERS:
25         return GROUPS.get(userid, [])
26     else:
27         return []