aboutsummaryrefslogtreecommitdiffstats
path: root/jm2l/security.py
blob: 48672d74e32758cfdc29288f07114b67a2dbf644 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf8 -*-
from pyramid.security import Allow, Everyone, Authenticated

USERS = { 1:'editor',
          'editor':'editor',
          'viewer':'viewer'}
GROUPS = {'editor':['group:editors'], 1:['group:editors']}

def groupfinder(userid, request):
    if userid in USERS:
        return GROUPS.get(userid, [])

class EntryFactory(object):
    __acl__ = [(Allow, Everyone, 'view'),
               (Allow, Authenticated, 'create'),
               (Allow, Authenticated, 'edit'), ]
    
    def __init__(self, request):
        pass
        
class RootFactory(object):
    __acl__ = [ (Allow, Everyone, 'view'),
                (Allow, 'group:editors', 'edit') ]
    def __init__(self, request):
        pass