schema.py
branchstable
changeset 4757 5d937aeaa6fb
parent 4755 13a5d3a7410e
child 4759 af2e6c377c71
--- a/schema.py	Tue Mar 02 15:57:32 2010 +0100
+++ b/schema.py	Tue Mar 02 15:58:39 2010 +0100
@@ -1082,8 +1082,16 @@
         cw = entity._cw
     elif form is not None:
         cw = form._cw
-    if cw is not None and cw.user.has_permission(PERM_USE_TEMPLATE_FORMAT):
-        return self.regular_formats + tuple(NEED_PERM_FORMATS)
+    if cw is not None:
+        if hasattr(cw, 'is_super_session'):
+            # cw is a server session
+            hasperm = cw.is_super_session or \
+                      not cw.vreg.config.is_hook_category_activated('integrity') or \
+                      cw.user.has_permission(PERM_USE_TEMPLATE_FORMAT)
+        else:
+            hasperm = cw.user.has_permission(PERM_USE_TEMPLATE_FORMAT)
+        if hasperm:
+            return self.regular_formats + tuple(NEED_PERM_FORMATS)
     return self.regular_formats
 
 # XXX monkey patch PyFileReader.import_erschema until bw_normalize_etype is