server/ssplanner.py
changeset 8562 0d2fb4604265
parent 8127 96d343a5e01b
child 8694 d901c36bcfce
equal deleted inserted replaced
8561:77ea3eed9946 8562:0d2fb4604265
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    25 from rql.nodes import Constant, Relation
    25 from rql.nodes import Constant, Relation
    26 
    26 
    27 from cubicweb import QueryError, typed_eid
    27 from cubicweb import QueryError, typed_eid
    28 from cubicweb.schema import VIRTUAL_RTYPES
    28 from cubicweb.schema import VIRTUAL_RTYPES
    29 from cubicweb.rqlrewrite import add_types_restriction
    29 from cubicweb.rqlrewrite import add_types_restriction
    30 from cubicweb.server.session import security_enabled
       
    31 from cubicweb.server.edition import EditedEntity
    30 from cubicweb.server.edition import EditedEntity
    32 
    31 
    33 READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity'))
    32 READ_ONLY_RTYPES = set(('eid', 'has_text', 'is', 'is_instance_of', 'identity'))
    34 
    33 
    35 _CONSTANT = object()
    34 _CONSTANT = object()
    85                 eid = typed_eid(rhs.eval(plan.args))
    84                 eid = typed_eid(rhs.eval(plan.args))
    86                 # check read permission here since it may not be done by
    85                 # check read permission here since it may not be done by
    87                 # the generated select substep if not emited (eg nothing
    86                 # the generated select substep if not emited (eg nothing
    88                 # to be selected)
    87                 # to be selected)
    89                 if checkread and eid not in neweids:
    88                 if checkread and eid not in neweids:
    90                     with security_enabled(session, read=False):
    89                     with session.security_enabled(read=False):
    91                         eschema(session.describe(eid)[0]).check_perm(
    90                         eschema(session.describe(eid)[0]).check_perm(
    92                             session, 'read', eid=eid)
    91                             session, 'read', eid=eid)
    93                 eidconsts[lhs.variable] = eid
    92                 eidconsts[lhs.variable] = eid
    94     return eidconsts
    93     return eidconsts
    95 
    94