# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1231865839 -3600 # Node ID 1cc99ab21304802f066435e3349a15739fa7c161 # Parent 45a6755154271bd4d245f5546c24e3233e37bd62 fix w/ local roles diff -r 45a675515427 -r 1cc99ab21304 common/selectors.py --- 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):