entity.py
branchstable
changeset 8472 444a8e25c940
parent 8307 8be58694f416
child 8535 268b6349baf3
child 8651 353bbd17a8b6
--- a/entity.py	Tue Jul 17 12:06:52 2012 +0200
+++ b/entity.py	Wed Jul 18 17:26:59 2012 +0200
@@ -1112,6 +1112,9 @@
         # insert security RQL expressions granting the permission to 'add' the
         # relation into the rql syntax tree, if necessary
         rqlexprs = rdef.get_rqlexprs('add')
+        if not self.has_eid():
+            rqlexprs = [rqlexpr for rqlexpr in rqlexprs
+                        if searchedvar.name in rqlexpr.mainvars]
         if rqlexprs and not rdef.has_perm(self._cw, 'add', **sec_check_args):
             # compute a varmap suitable to RQLRewriter.rewrite argument
             varmap = dict((v, v) for v in (searchedvar.name, evar.name)