# -*- 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        
