server/securityhooks.py
branch3.5
changeset 2920 64322aa83a1d
parent 2647 b0a2e779845c
child 3689 deb13e88e037
--- a/server/securityhooks.py	Thu Aug 20 17:33:05 2009 +0200
+++ b/server/securityhooks.py	Thu Aug 20 17:44:27 2009 +0200
@@ -70,11 +70,17 @@
 
 def before_add_relation(session, fromeid, rtype, toeid):
     if rtype in BEFORE_ADD_RELATIONS and not session.is_super_session:
+        nocheck = session.transaction_data.get('skip-security', ())
+        if (fromeid, rtype, toeid) in nocheck:
+            return
         rschema = session.repo.schema[rtype]
         rschema.check_perm(session, 'add', fromeid, toeid)
 
 def after_add_relation(session, fromeid, rtype, toeid):
     if not rtype in BEFORE_ADD_RELATIONS and not session.is_super_session:
+        nocheck = session.transaction_data.get('skip-security', ())
+        if (fromeid, rtype, toeid) in nocheck:
+            return
         rschema = session.repo.schema[rtype]
         if rtype in ON_COMMIT_ADD_RELATIONS:
             CheckRelationPermissionOp(session, action='add', rschema=rschema,
@@ -84,6 +90,9 @@
 
 def before_del_relation(session, fromeid, rtype, toeid):
     if not session.is_super_session:
+        nocheck = session.transaction_data.get('skip-security', ())
+        if (fromeid, rtype, toeid) in nocheck:
+            return
         session.repo.schema[rtype].check_perm(session, 'delete', fromeid, toeid)
 
 def register_security_hooks(hm):