aboutsummaryrefslogtreecommitdiffstats
path: root/jm2l/security.py
diff options
context:
space:
mode:
Diffstat (limited to 'jm2l/security.py')
-rw-r--r--jm2l/security.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/jm2l/security.py b/jm2l/security.py
new file mode 100644
index 0000000..48672d7
--- /dev/null
+++ b/jm2l/security.py
@@ -0,0 +1,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