You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Shikha Jaiswal <sh...@hotwaxsystems.com> on 2021/03/02 11:16:32 UTC

Problem in EECA - action

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

Re: Problem in EECA - action

Posted by Rishi Solanki <ri...@gmail.com>.
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 <pa...@hotwaxsystems.com>
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 <
> shikha.jaiswal@hotwaxsystems.com> 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
> >
>

Re: Problem in EECA - action

Posted by Pawan Verma <pa...@hotwaxsystems.com>.
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 <
shikha.jaiswal@hotwaxsystems.com> 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
>