[security] SchemaRelation.has_perm grows to new arguments allowing to specify subject/object entity type when actual eid are not known, but their types are stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 14 Jun 2010 18:59:05 +0200
branchstable
changeset 5746 f4fc424747db
parent 5745 d532fe79800b
child 5747 d6ac0cd30fde
[security] SchemaRelation.has_perm grows to new arguments allowing to specify subject/object entity type when actual eid are not known, but their types are
schema.py
--- a/schema.py	Mon Jun 14 18:58:06 2010 +0200
+++ b/schema.py	Mon Jun 14 18:59:05 2010 +0200
@@ -471,10 +471,14 @@
             assert action in ('read', 'add', 'delete')
             if 'fromeid' in kwargs:
                 subjtype = session.describe(kwargs['fromeid'])[0]
+            elif 'frometype' in kwargs:
+                subjtype = kwargs.pop('frometype')
             else:
                 subjtype = None
             if 'toeid' in kwargs:
                 objtype = session.describe(kwargs['toeid'])[0]
+            elif 'toetype' in kwargs:
+                objtype = kwargs.pop('toetype')
             else:
                 objtype = None
         if objtype and subjtype: