common/selectors.py
changeset 394 1cc99ab21304
parent 367 2c0d00b40387
child 402 e0cb1579eba2
--- a/common/selectors.py	Tue Jan 13 17:56:02 2009 +0100
+++ b/common/selectors.py	Tue Jan 13 17:57:19 2009 +0100
@@ -410,7 +410,8 @@
         if not (eschema.has_perm(req, perm) or eschema.has_local_role(perm)):
             return 0
     if hasattr(cls, 'rtype'):
-        if not schema.rschema(cls.rtype).has_perm(req, perm):
+        rschema = schema.rschema(cls.rtype)
+        if not (rschema.has_perm(req, perm) or rschema.has_local_role(perm)):
             return 0
     return 1
 
@@ -421,8 +422,9 @@
     result set has this relation.
     """
     if hasattr(cls, 'rtype'):
+        rschema = cls.schema.rschema(cls.rtype)
         perm = getattr(cls, 'require_permission', 'read')
-        if not cls.schema.rschema(cls.rtype).has_perm(req, perm):
+        if not (rschema.has_perm(req, perm) or rschema.has_local_role(perm)):
             return 0
         if row is None:
             for etype in rset.column_types(col or 0):
@@ -439,8 +441,9 @@
     .rtype attribute of the class, and if at least one entity type in the
     result set has this relation.
     """
+    rschema = cls.schema.rschema(cls.rtype)
     perm = getattr(cls, 'require_permission', 'read')
-    if not cls.schema.rschema(cls.rtype).has_perm(req, perm):
+    if not (rschema.has_perm(req, perm) or rschema.has_local_role(perm)):
         return 0
     if row is None:
         for etype in rset.column_types(col or 0):