Question related to eecas

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

Question related to eecas

Nikita Shinde
Hello All,

 

             When I trigger a service on an eecas, I always get userLogin as
"admin" which is correct because "run-as-user" being defaulted to "admin".

 

             But in the triggered service, I want the userLogin to be the
existing logged in user, is there a way to get that?

         

 

Kind Regards,

Nikita Shinde

Amicon Technologies Pvt. Ltd., Mumbai, India.

 

Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

Jacques Le Roux
Administrator
Hi Nikita,

"run-as-user" is defaulted to "system" not admin for some times now (see entity-eca.xsd).
I think you should poke into EntityEcaAction.java around line 80 and change their for your purpose.
BTW, it's weird to use an EECA with an user different than system, what is the purpose ?

Jacques

From: "Nikita Shinde" <[hidden email]>

> Hello All,
>
>
>
>             When I trigger a service on an eecas, I always get userLogin as
> "admin" which is correct because "run-as-user" being defaulted to "admin".
>
>
>
>             But in the triggered service, I want the userLogin to be the
> existing logged in user, is there a way to get that?
>
>          
>
>
>
> Kind Regards,
>
> Nikita Shinde
>
> Amicon Technologies Pvt. Ltd., Mumbai, India.
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Question related to eecas

Nikita Shinde
Hi Jacques,

          I wanted to track the history of changes(CUD) made to any entity
and who made those changes. So I wrote a service to do that which was
triggered by eecas on that entity. But in my service I could never get the
current logged in user who was making those changes, it always gave me
admin(because in my entity-eca.xsd its set to admin).

        I had a work around for this by using secas instead.

Regards,
Nikita.

-----Original Message-----
From: Jacques Le Roux [mailto:[hidden email]]
Sent: Thursday, February 05, 2009 5:34 AM
To: [hidden email]
Subject: Re: Question related to eecas

Hi Nikita,

"run-as-user" is defaulted to "system" not admin for some times now (see
entity-eca.xsd).
I think you should poke into EntityEcaAction.java around line 80 and change
their for your purpose.
BTW, it's weird to use an EECA with an user different than system, what is
the purpose ?

Jacques

From: "Nikita Shinde" <[hidden email]>
> Hello All,
>
>
>
>             When I trigger a service on an eecas, I always get userLogin
as

> "admin" which is correct because "run-as-user" being defaulted to "admin".
>
>
>
>             But in the triggered service, I want the userLogin to be the
> existing logged in user, is there a way to get that?
>
>          
>
>
>
> Kind Regards,
>
> Nikita Shinde
>
> Amicon Technologies Pvt. Ltd., Mumbai, India.
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

Bruno Busco
Yes,
your solution makes sense.
I have another eecas related question.

I am facing a case in which in an "create-store" eeca I need to update
the entity content itself.
So an endless loop happens.

Is there a way to hinibit the eeca retrigger due to an entity store in
the eeca itself?

Many thanks,
Bruno

2009/2/7 Nikita Shinde <[hidden email]>:

> Hi Jacques,
>
>          I wanted to track the history of changes(CUD) made to any entity
> and who made those changes. So I wrote a service to do that which was
> triggered by eecas on that entity. But in my service I could never get the
> current logged in user who was making those changes, it always gave me
> admin(because in my entity-eca.xsd its set to admin).
>
>        I had a work around for this by using secas instead.
>
> Regards,
> Nikita.
>
> -----Original Message-----
> From: Jacques Le Roux [mailto:[hidden email]]
> Sent: Thursday, February 05, 2009 5:34 AM
> To: [hidden email]
> Subject: Re: Question related to eecas
>
> Hi Nikita,
>
> "run-as-user" is defaulted to "system" not admin for some times now (see
> entity-eca.xsd).
> I think you should poke into EntityEcaAction.java around line 80 and change
> their for your purpose.
> BTW, it's weird to use an EECA with an user different than system, what is
> the purpose ?
>
> Jacques
>
> From: "Nikita Shinde" <[hidden email]>
>> Hello All,
>>
>>
>>
>>             When I trigger a service on an eecas, I always get userLogin
> as
>> "admin" which is correct because "run-as-user" being defaulted to "admin".
>>
>>
>>
>>             But in the triggered service, I want the userLogin to be the
>> existing logged in user, is there a way to get that?
>>
>>
>>
>>
>>
>> Kind Regards,
>>
>> Nikita Shinde
>>
>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>
>>
>>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

Jacques Le Roux
Administrator
In reply to this post by Nikita Shinde
From: "Nikita Shinde" <[hidden email]>
> Hi Jacques,
>
>   I wanted to track the history of changes(CUD) made to any entity
> and who made those changes. So I wrote a service to do that which was
> triggered by eecas on that entity. But in my service I could never get the
> current logged in user who was making those changes, it always gave me
> admin(because in my entity-eca.xsd its set to admin).
>
>        I had a work around for this by using secas instead.

Yes, this is a good choice indeed

Jacques
 

> Regards,
> Nikita.
>
> -----Original Message-----
> From: Jacques Le Roux [mailto:[hidden email]]
> Sent: Thursday, February 05, 2009 5:34 AM
> To: [hidden email]
> Subject: Re: Question related to eecas
>
> Hi Nikita,
>
> "run-as-user" is defaulted to "system" not admin for some times now (see
> entity-eca.xsd).
> I think you should poke into EntityEcaAction.java around line 80 and change
> their for your purpose.
> BTW, it's weird to use an EECA with an user different than system, what is
> the purpose ?
>
> Jacques
>
> From: "Nikita Shinde" <[hidden email]>
>> Hello All,
>>
>>
>>
>>             When I trigger a service on an eecas, I always get userLogin
> as
>> "admin" which is correct because "run-as-user" being defaulted to "admin".
>>
>>
>>
>>             But in the triggered service, I want the userLogin to be the
>> existing logged in user, is there a way to get that?
>>
>>          
>>
>>
>>
>> Kind Regards,
>>
>> Nikita Shinde
>>
>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

Vikas Mayur-3
In reply to this post by Nikita Shinde
I think this could be done using enable-audit-log feature, but I am  
not sure as I never tested this stuff.

For more information refer to http://www.nabble.com/svn-commit%3A-r652226---in--ofbiz-trunk-framework%3A-entity-dtd--entity-entitydef--entity-src-org-ofbiz-entity--entity-src-org-ofbiz-entity-datasource--entity-src-org-ofbiz-entity-jdbc--entity-src-org-ofbiz-entity-model--service-src-org-ofbiz-service--weba...-td16974277.html#a16974277


Vikas

On Feb 7, 2009, at 7:50 PM, Nikita Shinde wrote:

> Hi Jacques,
>
>  I wanted to track the history of changes(CUD) made to any entity
> and who made those changes. So I wrote a service to do that which was
> triggered by eecas on that entity. But in my service I could never  
> get the
> current logged in user who was making those changes, it always gave me
> admin(because in my entity-eca.xsd its set to admin).
>
>        I had a work around for this by using secas instead.
>
> Regards,
> Nikita.
>
> -----Original Message-----
> From: Jacques Le Roux [mailto:[hidden email]]
> Sent: Thursday, February 05, 2009 5:34 AM
> To: [hidden email]
> Subject: Re: Question related to eecas
>
> Hi Nikita,
>
> "run-as-user" is defaulted to "system" not admin for some times now  
> (see
> entity-eca.xsd).
> I think you should poke into EntityEcaAction.java around line 80 and  
> change
> their for your purpose.
> BTW, it's weird to use an EECA with an user different than system,  
> what is
> the purpose ?
>
> Jacques
>
> From: "Nikita Shinde" <[hidden email]>
>> Hello All,
>>
>>
>>
>>            When I trigger a service on an eecas, I always get  
>> userLogin
> as
>> "admin" which is correct because "run-as-user" being defaulted to  
>> "admin".
>>
>>
>>
>>            But in the triggered service, I want the userLogin to be  
>> the
>> existing logged in user, is there a way to get that?
>>
>>
>>
>>
>>
>> Kind Regards,
>>
>> Nikita Shinde
>>
>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>
>>
>>
>>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

David E Jones-3

Yes, the audit logging feature would be the easiest way to do this.

-David

On Feb 7, 2009, at 10:26 AM, Vikas Mayur wrote:

> I think this could be done using enable-audit-log feature, but I am  
> not sure as I never tested this stuff.
>
> For more information refer to http://www.nabble.com/svn-commit%3A-r652226---in--ofbiz-trunk-framework%3A-entity-dtd--entity-entitydef--entity-src-org-ofbiz-entity--entity-src-org-ofbiz-entity-datasource--entity-src-org-ofbiz-entity-jdbc--entity-src-org-ofbiz-entity-model--service-src-org-ofbiz-service--weba...-td16974277.html#a16974277
>
>
> Vikas
>
> On Feb 7, 2009, at 7:50 PM, Nikita Shinde wrote:
>
>> Hi Jacques,
>>
>>  I wanted to track the history of changes(CUD) made to any entity
>> and who made those changes. So I wrote a service to do that which was
>> triggered by eecas on that entity. But in my service I could never  
>> get the
>> current logged in user who was making those changes, it always gave  
>> me
>> admin(because in my entity-eca.xsd its set to admin).
>>
>>       I had a work around for this by using secas instead.
>>
>> Regards,
>> Nikita.
>>
>> -----Original Message-----
>> From: Jacques Le Roux [mailto:[hidden email]]
>> Sent: Thursday, February 05, 2009 5:34 AM
>> To: [hidden email]
>> Subject: Re: Question related to eecas
>>
>> Hi Nikita,
>>
>> "run-as-user" is defaulted to "system" not admin for some times now  
>> (see
>> entity-eca.xsd).
>> I think you should poke into EntityEcaAction.java around line 80  
>> and change
>> their for your purpose.
>> BTW, it's weird to use an EECA with an user different than system,  
>> what is
>> the purpose ?
>>
>> Jacques
>>
>> From: "Nikita Shinde" <[hidden email]>
>>> Hello All,
>>>
>>>
>>>
>>>           When I trigger a service on an eecas, I always get  
>>> userLogin
>> as
>>> "admin" which is correct because "run-as-user" being defaulted to  
>>> "admin".
>>>
>>>
>>>
>>>           But in the triggered service, I want the userLogin to be  
>>> the
>>> existing logged in user, is there a way to get that?
>>>
>>>
>>>
>>>
>>>
>>> Kind Regards,
>>>
>>> Nikita Shinde
>>>
>>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>>
>>>
>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

David E Jones-3
In reply to this post by Bruno Busco

A general rule for EECAs and SECAs that may or may not apply here (not  
enough info to tell):

- EECAs are for maintaining derived data like a total field or a  
keyword index

- SECAs are for triggering business processes based on business events

If you use either one for the other's purpose you'll likely run into  
trouble. It can work, but it's like using a hammer instead of a screw  
driver to put a screw into something... it's just the wrong tool.

As for updating an entity in a service triggered by an EECA on that  
entity... I'd be interested in hearing what you are trying to do. It's  
either the wrong tool, a bad data structure, or a simple lack of  
having a condition to see if a change happened that would require the  
ECA to run (or whatever condition would distinguish the before and  
after states).

HTH as it's a shot in the dark ;)

-David


On Feb 7, 2009, at 7:27 AM, Bruno Busco wrote:

> Yes,
> your solution makes sense.
> I have another eecas related question.
>
> I am facing a case in which in an "create-store" eeca I need to update
> the entity content itself.
> So an endless loop happens.
>
> Is there a way to hinibit the eeca retrigger due to an entity store in
> the eeca itself?
>
> Many thanks,
> Bruno
>
> 2009/2/7 Nikita Shinde <[hidden email]>:
>> Hi Jacques,
>>
>>         I wanted to track the history of changes(CUD) made to any  
>> entity
>> and who made those changes. So I wrote a service to do that which was
>> triggered by eecas on that entity. But in my service I could never  
>> get the
>> current logged in user who was making those changes, it always gave  
>> me
>> admin(because in my entity-eca.xsd its set to admin).
>>
>>       I had a work around for this by using secas instead.
>>
>> Regards,
>> Nikita.
>>
>> -----Original Message-----
>> From: Jacques Le Roux [mailto:[hidden email]]
>> Sent: Thursday, February 05, 2009 5:34 AM
>> To: [hidden email]
>> Subject: Re: Question related to eecas
>>
>> Hi Nikita,
>>
>> "run-as-user" is defaulted to "system" not admin for some times now  
>> (see
>> entity-eca.xsd).
>> I think you should poke into EntityEcaAction.java around line 80  
>> and change
>> their for your purpose.
>> BTW, it's weird to use an EECA with an user different than system,  
>> what is
>> the purpose ?
>>
>> Jacques
>>
>> From: "Nikita Shinde" <[hidden email]>
>>> Hello All,
>>>
>>>
>>>
>>>            When I trigger a service on an eecas, I always get  
>>> userLogin
>> as
>>> "admin" which is correct because "run-as-user" being defaulted to  
>>> "admin".
>>>
>>>
>>>
>>>            But in the triggered service, I want the userLogin to  
>>> be the
>>> existing logged in user, is there a way to get that?
>>>
>>>
>>>
>>>
>>>
>>> Kind Regards,
>>>
>>> Nikita Shinde
>>>
>>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>>
>>>
>>>
>>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

Bruno Busco
David,
many thanks for your help here. It is my first approach to EECAs and
SECAs and this light in the dark really helps! ;-)

-Bruno

2009/2/7 David E Jones <[hidden email]>:

>
> A general rule for EECAs and SECAs that may or may not apply here (not
> enough info to tell):
>
> - EECAs are for maintaining derived data like a total field or a keyword
> index
>
> - SECAs are for triggering business processes based on business events
>
> If you use either one for the other's purpose you'll likely run into
> trouble. It can work, but it's like using a hammer instead of a screw driver
> to put a screw into something... it's just the wrong tool.
>
> As for updating an entity in a service triggered by an EECA on that
> entity... I'd be interested in hearing what you are trying to do. It's
> either the wrong tool, a bad data structure, or a simple lack of having a
> condition to see if a change happened that would require the ECA to run (or
> whatever condition would distinguish the before and after states).
>
> HTH as it's a shot in the dark ;)
>
> -David
>
>
> On Feb 7, 2009, at 7:27 AM, Bruno Busco wrote:
>
>> Yes,
>> your solution makes sense.
>> I have another eecas related question.
>>
>> I am facing a case in which in an "create-store" eeca I need to update
>> the entity content itself.
>> So an endless loop happens.
>>
>> Is there a way to hinibit the eeca retrigger due to an entity store in
>> the eeca itself?
>>
>> Many thanks,
>> Bruno
>>
>> 2009/2/7 Nikita Shinde <[hidden email]>:
>>>
>>> Hi Jacques,
>>>
>>>        I wanted to track the history of changes(CUD) made to any entity
>>> and who made those changes. So I wrote a service to do that which was
>>> triggered by eecas on that entity. But in my service I could never get
>>> the
>>> current logged in user who was making those changes, it always gave me
>>> admin(because in my entity-eca.xsd its set to admin).
>>>
>>>      I had a work around for this by using secas instead.
>>>
>>> Regards,
>>> Nikita.
>>>
>>> -----Original Message-----
>>> From: Jacques Le Roux [mailto:[hidden email]]
>>> Sent: Thursday, February 05, 2009 5:34 AM
>>> To: [hidden email]
>>> Subject: Re: Question related to eecas
>>>
>>> Hi Nikita,
>>>
>>> "run-as-user" is defaulted to "system" not admin for some times now (see
>>> entity-eca.xsd).
>>> I think you should poke into EntityEcaAction.java around line 80 and
>>> change
>>> their for your purpose.
>>> BTW, it's weird to use an EECA with an user different than system, what
>>> is
>>> the purpose ?
>>>
>>> Jacques
>>>
>>> From: "Nikita Shinde" <[hidden email]>
>>>>
>>>> Hello All,
>>>>
>>>>
>>>>
>>>>           When I trigger a service on an eecas, I always get userLogin
>>>
>>> as
>>>>
>>>> "admin" which is correct because "run-as-user" being defaulted to
>>>> "admin".
>>>>
>>>>
>>>>
>>>>           But in the triggered service, I want the userLogin to be the
>>>> existing logged in user, is there a way to get that?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Kind Regards,
>>>>
>>>> Nikita Shinde
>>>>
>>>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Question related to eecas

Nikita Shinde
In reply to this post by David E Jones-3
It certainly seems the easiest way ...thank you for sharing this.

Regards,
Nikita.

-----Original Message-----
From: David E Jones [mailto:[hidden email]]
Sent: Sunday, February 08, 2009 2:49 AM
To: [hidden email]
Subject: Re: Question related to eecas


Yes, the audit logging feature would be the easiest way to do this.

-David

On Feb 7, 2009, at 10:26 AM, Vikas Mayur wrote:

> I think this could be done using enable-audit-log feature, but I am  
> not sure as I never tested this stuff.
>
> For more information refer to
http://www.nabble.com/svn-commit%3A-r652226---in--ofbiz-trunk-framework%3A-e
ntity-dtd--entity-entitydef--entity-src-org-ofbiz-entity--entity-src-org-ofb
iz-entity-datasource--entity-src-org-ofbiz-entity-jdbc--entity-src-org-ofbiz
-entity-model--service-src-org-ofbiz-service--weba...-td16974277.html#a16974
277

>
>
> Vikas
>
> On Feb 7, 2009, at 7:50 PM, Nikita Shinde wrote:
>
>> Hi Jacques,
>>
>>  I wanted to track the history of changes(CUD) made to any entity
>> and who made those changes. So I wrote a service to do that which was
>> triggered by eecas on that entity. But in my service I could never  
>> get the
>> current logged in user who was making those changes, it always gave  
>> me
>> admin(because in my entity-eca.xsd its set to admin).
>>
>>       I had a work around for this by using secas instead.
>>
>> Regards,
>> Nikita.
>>
>> -----Original Message-----
>> From: Jacques Le Roux [mailto:[hidden email]]
>> Sent: Thursday, February 05, 2009 5:34 AM
>> To: [hidden email]
>> Subject: Re: Question related to eecas
>>
>> Hi Nikita,
>>
>> "run-as-user" is defaulted to "system" not admin for some times now  
>> (see
>> entity-eca.xsd).
>> I think you should poke into EntityEcaAction.java around line 80  
>> and change
>> their for your purpose.
>> BTW, it's weird to use an EECA with an user different than system,  
>> what is
>> the purpose ?
>>
>> Jacques
>>
>> From: "Nikita Shinde" <[hidden email]>
>>> Hello All,
>>>
>>>
>>>
>>>           When I trigger a service on an eecas, I always get  
>>> userLogin
>> as
>>> "admin" which is correct because "run-as-user" being defaulted to  
>>> "admin".
>>>
>>>
>>>
>>>           But in the triggered service, I want the userLogin to be  
>>> the
>>> existing logged in user, is there a way to get that?
>>>
>>>
>>>
>>>
>>>
>>> Kind Regards,
>>>
>>> Nikita Shinde
>>>
>>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>>
>>>
>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Question related to eecas

Jacopo Cappellato-4
In reply to this post by Bruno Busco
I think there is also a special delegator configured in  
entityengine.xml where ecas are not run.

Jacopo

On Feb 8, 2009, at 11:32 AM, Bruno Busco wrote:

> David,
> many thanks for your help here. It is my first approach to EECAs and
> SECAs and this light in the dark really helps! ;-)
>
> -Bruno
>
> 2009/2/7 David E Jones <[hidden email]>:
>>
>> A general rule for EECAs and SECAs that may or may not apply here  
>> (not
>> enough info to tell):
>>
>> - EECAs are for maintaining derived data like a total field or a  
>> keyword
>> index
>>
>> - SECAs are for triggering business processes based on business  
>> events
>>
>> If you use either one for the other's purpose you'll likely run into
>> trouble. It can work, but it's like using a hammer instead of a  
>> screw driver
>> to put a screw into something... it's just the wrong tool.
>>
>> As for updating an entity in a service triggered by an EECA on that
>> entity... I'd be interested in hearing what you are trying to do.  
>> It's
>> either the wrong tool, a bad data structure, or a simple lack of  
>> having a
>> condition to see if a change happened that would require the ECA to  
>> run (or
>> whatever condition would distinguish the before and after states).
>>
>> HTH as it's a shot in the dark ;)
>>
>> -David
>>
>>
>> On Feb 7, 2009, at 7:27 AM, Bruno Busco wrote:
>>
>>> Yes,
>>> your solution makes sense.
>>> I have another eecas related question.
>>>
>>> I am facing a case in which in an "create-store" eeca I need to  
>>> update
>>> the entity content itself.
>>> So an endless loop happens.
>>>
>>> Is there a way to hinibit the eeca retrigger due to an entity  
>>> store in
>>> the eeca itself?
>>>
>>> Many thanks,
>>> Bruno
>>>
>>> 2009/2/7 Nikita Shinde <[hidden email]>:
>>>>
>>>> Hi Jacques,
>>>>
>>>>       I wanted to track the history of changes(CUD) made to any  
>>>> entity
>>>> and who made those changes. So I wrote a service to do that which  
>>>> was
>>>> triggered by eecas on that entity. But in my service I could  
>>>> never get
>>>> the
>>>> current logged in user who was making those changes, it always  
>>>> gave me
>>>> admin(because in my entity-eca.xsd its set to admin).
>>>>
>>>>     I had a work around for this by using secas instead.
>>>>
>>>> Regards,
>>>> Nikita.
>>>>
>>>> -----Original Message-----
>>>> From: Jacques Le Roux [mailto:[hidden email]]
>>>> Sent: Thursday, February 05, 2009 5:34 AM
>>>> To: [hidden email]
>>>> Subject: Re: Question related to eecas
>>>>
>>>> Hi Nikita,
>>>>
>>>> "run-as-user" is defaulted to "system" not admin for some times  
>>>> now (see
>>>> entity-eca.xsd).
>>>> I think you should poke into EntityEcaAction.java around line 80  
>>>> and
>>>> change
>>>> their for your purpose.
>>>> BTW, it's weird to use an EECA with an user different than  
>>>> system, what
>>>> is
>>>> the purpose ?
>>>>
>>>> Jacques
>>>>
>>>> From: "Nikita Shinde" <[hidden email]>
>>>>>
>>>>> Hello All,
>>>>>
>>>>>
>>>>>
>>>>>          When I trigger a service on an eecas, I always get  
>>>>> userLogin
>>>>
>>>> as
>>>>>
>>>>> "admin" which is correct because "run-as-user" being defaulted to
>>>>> "admin".
>>>>>
>>>>>
>>>>>
>>>>>          But in the triggered service, I want the userLogin to  
>>>>> be the
>>>>> existing logged in user, is there a way to get that?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Kind Regards,
>>>>>
>>>>> Nikita Shinde
>>>>>
>>>>> Amicon Technologies Pvt. Ltd., Mumbai, India.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>
>>


smime.p7s (3K) Download Attachment