hooks/security.py
changeset 2968 0e3460341023
parent 2920 64322aa83a1d
parent 2895 903bd3f89f80
child 3376 f5c69485381f
--- a/hooks/security.py	Tue Aug 18 09:25:44 2009 +0200
+++ b/hooks/security.py	Fri Aug 21 16:26:20 2009 +0200
@@ -91,6 +91,9 @@
 
     def __call__(self):
         if self.rtype in BEFORE_ADD_RELATIONS:
+            nocheck = self._cw.transaction_data.get('skip-security', ())
+            if (self.eidfrom, self.rtype, self.eidto) in nocheck:
+                return
             rschema = self._cw.repo.schema[self.rtype]
             rschema.check_perm(self._cw, 'add', self.eidfrom, self.eidto)
 
@@ -101,6 +104,9 @@
 
     def __call__(self):
         if not self.rtype in BEFORE_ADD_RELATIONS:
+            nocheck = self._cw.transaction_data.get('skip-security', ())
+            if (self.eidfrom, self.rtype, self.eidto) in nocheck:
+                return
             rschema = self._cw.repo.schema[self.rtype]
             if self.rtype in ON_COMMIT_ADD_RELATIONS:
                 _CheckRelationPermissionOp(self._cw, action='add',
@@ -116,6 +122,9 @@
     events = ('before_delete_relation',)
 
     def __call__(self):
+        nocheck = self._cw.transaction_data.get('skip-security', ())
+        if (self.eidfrom, self.rtype, self.eidto) in nocheck:
+            return
         self._cw.repo.schema[self.rtype].check_perm(self._cw, 'delete',
                                                        self.eidfrom, self.eidto)