entity.py
changeset 8535 268b6349baf3
parent 8525 c09feae04094
parent 8472 444a8e25c940
child 8621 038d67f42061
--- a/entity.py	Fri Aug 03 13:29:37 2012 +0200
+++ b/entity.py	Fri Sep 07 14:01:59 2012 +0200
@@ -1153,6 +1153,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)