Ah, thanks Jesse
So from 1.509 you could do the following
import hudson.model.*
CauseAction action = build.getAction(CauseAction.class)
if (action != null) build.getActions().remove(action)
//This is the tricky part
User otherUser = User.get("username")
ACL.impersonate(otherUser.impersonate()) {
build.addAction(new CauseAction(new Cause.UserIdCause()))
}
I guess :)
Robert Sandell
Software Tools Engineer - SW Environment and Product Configuration
Sony Mobile Communications
> -----Original Message-----
> From: [email protected] [mailto:jenkinsci-
> [email protected]] On Behalf Of Jesse Glick
> Sent: den 13 juni 2013 14:43
> To: [email protected]
> Subject: Re: Reload build.xml after finishing build
>
> On 06/13/2013 04:58 AM, Sandell, Robert wrote:
> > def oldAuth =
> SecurityContextHolder.getContext().getAuthentication()
> > User otherUser = User.get("username")
> >
> SecurityContextHolder.getContext().setAuthentication(otherUser.imperson
> ate())
> > build.addAction(new CauseAction(new Cause.UserIdCause()))
> > SecurityContextHolder.getContext().setAuthentication(oldAuth)
>
> This is wrong (security hole), and not just because you forgot the
> finally block. Use ACL.impersonate and read its Javadoc for explanation.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.