run a service with the system userID

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

run a service with the system userID

Hans Bakker
Hi ofbiz enthousiasts.

I checked the whole OFBiz system but could not find an example.

Did somebody succeed to run, within a minilanguage script, a service using the
'system' userid? (this loginid is in the sysadmin group) So not the logged on
user id?

In the checkout process where somebody just registered i need to sometimes run
a service which can only be run with a proper sysadmin userid.

I tried everything, replacing the userLogin GenericValue in the context,
environment, passing it to the service but the system always took the logged
on user.

anybody done that? David?

--
Regards,
Hans Bakker
ANT Websystems Co.,Ltd (http://www.antwebsystems.com)

If you want to verify that this message really originates from
from the above person, download the public key from:
http://www.antwebsystems.com/hbakkerAntwebsystems.asc

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: run a service with the system userID

Andrew Zeneski
I usually do this when they are scheduled services and loaded w/ seed  
data. You can also set the user ID to run ECAs. However, when running  
a service called through a web event it will always use the logged in  
user.

Andy

On Jun 26, 2006, at 11:00 PM, Hans Bakker wrote:

> Hi ofbiz enthousiasts.
>
> I checked the whole OFBiz system but could not find an example.
>
> Did somebody succeed to run, within a minilanguage script, a  
> service using the
> 'system' userid? (this loginid is in the sysadmin group) So not the  
> logged on
> user id?
>
> In the checkout process where somebody just registered i need to  
> sometimes run
> a service which can only be run with a proper sysadmin userid.
>
> I tried everything, replacing the userLogin GenericValue in the  
> context,
> environment, passing it to the service but the system always took  
> the logged
> on user.
>
> anybody done that? David?
>
> --
> Regards,
> Hans Bakker
> ANT Websystems Co.,Ltd (http://www.antwebsystems.com)
>
> If you want to verify that this message really originates from
> from the above person, download the public key from:
> http://www.antwebsystems.com/hbakkerAntwebsystems.asc

Reply | Threaded
Open this post in threaded view
|

Re: run a service with the system userID

Hans Bakker
Hi Andy,

thanks for your answer, I asked this because a user comes on a site, registers
and want to take out a subscription. I added a subscription service to the
content component where security obviously is needed.

however i would also like to use this service also when a new user registers
and his creditcard is found valid.

no solution for this? now i have to copy the services content and run it
without the security....duplication of code....

temporary change the userid to 'system' would be nice.....I already digged
into the minilanguage code, but not so easy stuff for me....

--
Regards,
Hans Bakker
ANT Websystems Co.,Ltd (http://www.antwebsystems.com)

If you want to verify that this message really originates from
from the above person, download the public key from:
http://www.antwebsystems.com/hbakkerAntwebsystems.asc

On Tuesday 27 June 2006 10:19, A. Zeneski wrote:

> I usually do this when they are scheduled services and loaded w/ seed
> data. You can also set the user ID to run ECAs. However, when running
> a service called through a web event it will always use the logged in
> user.
>
> Andy
>
> On Jun 26, 2006, at 11:00 PM, Hans Bakker wrote:
> > Hi ofbiz enthousiasts.
> >
> > I checked the whole OFBiz system but could not find an example.
> >
> > Did somebody succeed to run, within a minilanguage script, a
> > service using the
> > 'system' userid? (this loginid is in the sysadmin group) So not the
> > logged on
> > user id?
> >
> > In the checkout process where somebody just registered i need to
> > sometimes run
> > a service which can only be run with a proper sysadmin userid.
> >
> > I tried everything, replacing the userLogin GenericValue in the
> > context,
> > environment, passing it to the service but the system always took
> > the logged
> > on user.
> >
> > anybody done that? David?
> >
> > --
> > Regards,
> > Hans Bakker
> > ANT Websystems Co.,Ltd (http://www.antwebsystems.com)
> >
> > If you want to verify that this message really originates from
> > from the above person, download the public key from:
> > http://www.antwebsystems.com/hbakkerAntwebsystems.asc

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: run a service with the system userID

David E. Jones

So, you're asking how to do this from a simple-method?

Just do an entity-one to look up the "system" UserLogin, put it in the service input context, and then use the attribute on the call-service operation to not include the user (ie explicitly set it to false).

You can see stuff about these attributes in the XSD files, or the quick reference book, or whatever, and some docs exist on them in the MiniLang Guide.

-David


Hans Bakker wrote:

> Hi Andy,
>
> thanks for your answer, I asked this because a user comes on a site, registers
> and want to take out a subscription. I added a subscription service to the
> content component where security obviously is needed.
>
> however i would also like to use this service also when a new user registers
> and his creditcard is found valid.
>
> no solution for this? now i have to copy the services content and run it
> without the security....duplication of code....
>
> temporary change the userid to 'system' would be nice.....I already digged
> into the minilanguage code, but not so easy stuff for me....
>
Reply | Threaded
Open this post in threaded view
|

Re: run a service with the system userID

Hans Bakker
Thanks David, this is working very nicely. Thanks again.

On Tuesday 27 June 2006 12:11, David E Jones wrote:

> So, you're asking how to do this from a simple-method?
>
> Just do an entity-one to look up the "system" UserLogin, put it in the
> service input context, and then use the attribute on the call-service
> operation to not include the user (ie explicitly set it to false).
>
> You can see stuff about these attributes in the XSD files, or the quick
> reference book, or whatever, and some docs exist on them in the MiniLang
> Guide.
>
> -David
>
> Hans Bakker wrote:
> > Hi Andy,
> >
> > thanks for your answer, I asked this because a user comes on a site,
> > registers and want to take out a subscription. I added a subscription
> > service to the content component where security obviously is needed.
> >
> > however i would also like to use this service also when a new user
> > registers and his creditcard is found valid.
> >
> > no solution for this? now i have to copy the services content and run it
> > without the security....duplication of code....
> >
> > temporary change the userid to 'system' would be nice.....I already
> > digged into the minilanguage code, but not so easy stuff for me....
--
Regards,
Hans Bakker
ANT Websystems Co.,Ltd (http://www.antwebsystems.com)

If you want to verify that this message really originates from
from the above person, download the public key from:
http://www.antwebsystems.com/hbakkerAntwebsystems.asc

attachment0 (196 bytes) Download Attachment