# HG changeset patch # User Sylvain Thénault # Date 1253296273 -7200 # Node ID 2fa09be849e7427e4c9344efe400d6a175230228 # Parent 8430f6c693a10673650e0520815e69c84a392102 don't propose inlined form if user can't edit the entity diff -r 8430f6c693a1 -r 2fa09be849e7 web/views/formrenderers.py --- a/web/views/formrenderers.py Fri Sep 18 19:50:37 2009 +0200 +++ b/web/views/formrenderers.py Fri Sep 18 19:51:13 2009 +0200 @@ -491,11 +491,16 @@ __ = self.req.pgettext i18nctx = 'inlined:%s.%s.%s' % (entity.e_schema, rschema, role) w(u'
' % rschema) - existant = entity.has_eid() and entity.related(rschema) - if existant: + existant = False + related = entity.has_eid() and entity.related(rschema, role) + if related: # display inline-edition view for all existing related entities - w(form.view('inline-edition', existant, rtype=rschema, role=role, - ptype=entity.e_schema, peid=entity.eid)) + for i, relentity in enumerate(related.entities()): + if relentity.has_perm('update'): + w(form.view('inline-edition', related, row=i, col=0, + rtype=rschema, role=role, ptype=entity.e_schema, + peid=entity.eid, i18nctx=i18nctx)) + existant = True if role == 'subject': card = rschema.rproperty(entity.e_schema, targettype, 'cardinality')[0] else: @@ -524,6 +529,7 @@ w(u'
') + class EntityInlinedFormRenderer(EntityFormRenderer): """specific renderer for entity inlined edition form (inline-[creation|edition])