Problem in EECA - action

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem in EECA - action

Shikha Jaiswal
Hello Team,

We are facing an issue with EECA rule - The action service (entity-auto)
has changeByUserLoginId field which is always set as 'system' userLogin.

<eca entity="OrderItem" operation="create-store" event="return">
    <condition field-name="estimatedShipDate" operator="is-not-empty"/>
    <set field-name="changeDateTime" value="${groovy:
org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp()}"/>
    <action service="createEstDateHistory" mode="sync"/>
</eca>

When explored it, we found that in EECA, userLogin passed to action service
is always 'system'. Current userLogin is not passed in context and when
userLogin is empty, the run-as-user field is set to system userLogin by
default, as mentioned in entity-eca.xsd.

What could be the use case for this implementation? Shouldn't userLogin
should pass to action service from context, if not found then default to
system userLogin.

Please let me know your thoughts on this.

Thanks and Regards,
--
Shikha Jaiswal
Senior Enterprise Software Engineer
Reply | Threaded
Open this post in threaded view
|

Re: Problem in EECA - action

Pawan Verma
Hi Shikha,

As I can remember correctly(did not look at the code), you are right, the
current user is not passed to the action service. The reason is we don't
have a user login in the Delegator method(create/store).

If you did some workaround, please let us know.
--
Thanks & Regards
Pawan Verma
Technical Consultant
*HotWax Systems*
*Enterprise open source experts*
http://www.hotwaxsystems.com


On Tue, Mar 2, 2021 at 4:56 PM Shikha Jaiswal <
[hidden email]> wrote:

> Hello Team,
>
> We are facing an issue with EECA rule - The action service (entity-auto)
> has changeByUserLoginId field which is always set as 'system' userLogin.
>
> <eca entity="OrderItem" operation="create-store" event="return">
>     <condition field-name="estimatedShipDate" operator="is-not-empty"/>
>     <set field-name="changeDateTime" value="${groovy:
> org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp()}"/>
>     <action service="createEstDateHistory" mode="sync"/>
> </eca>
>
> When explored it, we found that in EECA, userLogin passed to action service
> is always 'system'. Current userLogin is not passed in context and when
> userLogin is empty, the run-as-user field is set to system userLogin by
> default, as mentioned in entity-eca.xsd.
>
> What could be the use case for this implementation? Shouldn't userLogin
> should pass to action service from context, if not found then default to
> system userLogin.
>
> Please let me know your thoughts on this.
>
> Thanks and Regards,
> --
> Shikha Jaiswal
> Senior Enterprise Software Engineer
>
Reply | Threaded
Open this post in threaded view
|

Re: Problem in EECA - action

Rishi Solanki
For few transactions in the database, they really taken care by the system
not by logged in user. I personally don't like the idea of system user
login but, but when we have direct db operations to perform without using
SECA instead EECA then system does not have any option to use logged in
user.

I agree with you, but we should also consider in few cases when logged in
user does not make any sense, one example is creating history records. That
means even after fixing this, wherever applicable we should not replace the
system userlogin usage always.

Best Regards,
--
Rishi Solanki
*CTO, Mindpath Technology*
Intelligent Solutions
cell: +91-98932-87847
LinkedIn <https://www.linkedin.com/in/rishi-solanki-62271b7/>


On Tue, Mar 2, 2021 at 9:45 PM Pawan Verma <[hidden email]>
wrote:

> Hi Shikha,
>
> As I can remember correctly(did not look at the code), you are right, the
> current user is not passed to the action service. The reason is we don't
> have a user login in the Delegator method(create/store).
>
> If you did some workaround, please let us know.
> --
> Thanks & Regards
> Pawan Verma
> Technical Consultant
> *HotWax Systems*
> *Enterprise open source experts*
> http://www.hotwaxsystems.com
>
>
> On Tue, Mar 2, 2021 at 4:56 PM Shikha Jaiswal <
> [hidden email]> wrote:
>
> > Hello Team,
> >
> > We are facing an issue with EECA rule - The action service (entity-auto)
> > has changeByUserLoginId field which is always set as 'system' userLogin.
> >
> > <eca entity="OrderItem" operation="create-store" event="return">
> >     <condition field-name="estimatedShipDate" operator="is-not-empty"/>
> >     <set field-name="changeDateTime" value="${groovy:
> > org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp()}"/>
> >     <action service="createEstDateHistory" mode="sync"/>
> > </eca>
> >
> > When explored it, we found that in EECA, userLogin passed to action
> service
> > is always 'system'. Current userLogin is not passed in context and when
> > userLogin is empty, the run-as-user field is set to system userLogin by
> > default, as mentioned in entity-eca.xsd.
> >
> > What could be the use case for this implementation? Shouldn't userLogin
> > should pass to action service from context, if not found then default to
> > system userLogin.
> >
> > Please let me know your thoughts on this.
> >
> > Thanks and Regards,
> > --
> > Shikha Jaiswal
> > Senior Enterprise Software Engineer
> >
>