constructed model, per node permissions via webservice

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

constructed model, per node permissions via webservice

ldeck
Hi there,

I've got some data that'd be loaded -- say a bunch of shopping cart items that belong to a business (rather than individual).

What I'm need to do is filter the list displayed having done a web service call per item to determine the permissions for the current user.

How would I go about that? Essentially, how do I apply the below to a list of items individually?


<xforms:instance id="props">
        <parameters>
                <HasWriteAccess />
        </parameters>
</xforms:instance>

<xforms:action ev:event="xforms-model-construct-done">
        <xforms:send submission="check-permissions" />
</xforms:action>

<xforms:submission id="check-permissions" method="get" serialization="none"
        resource="..."
        replace="none" f:url-type="resource">
        <xforms:action ev:event="xforms-submit-error">
            <xforms:setvalue ref="instance('props')/HasWriteAccess" value="'false'" />
        </xforms:action>
        <xforms:action ev:event="xforms-submit-done">
             <xforms:setvalue ref="instance('props')/HasWriteAccess" value="'true'" />
        </xforms:action>
    </xforms:submission>


cheers,
Lachlan

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: constructed model, per node permissions via webservice

Alessandro  Vernet
Administrator
Hi Lachlan,

Are you saying that the "check-permissions" submission would need to be called once per "shopping card item"? (I have a feeling that this way of doing it might be inefficient, but this is another question.) Then you'd need to iterate over the items in the shopping card, and for each item run the submission with something like:

<xf:send iterate="/shopping-card/item" submission="check-permissions">
    <xf:context name="item" select="."/>
</xf:send>

And in <xf:submission id="check-permissions"> you'll need to send some information about the current item so the service can do its job, which you can do by accessing the current item with event('item').

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet