Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Who run event handler?

Hi, I've some rights problem running an event handler on Build Result Changed. I want to change state to a work-item linked to BuildResult. I'm able to retrieve the work-item and the action to perform, but when I try to run the change of state I've got an exception of Authorization denied on running that specific action. But the user that requires the build has the permission to change that state and also the user running the build.
I've also tried to put all grants on everyone and only then I can change-state.
Both my user are in Project Area and Team Area.

Any idea??

0 votes



9 answers

Permanent link
On Thu, 27 Aug 2009 13:53:02 +0000, mikyjpeg wrote:

Hi, I've some rights problem running an event handler on Build Result
Changed. I want to change state to a work-item linked to BuildResult.
I'm able to retrieve the work-item and the action to perform, but when I
try to run the change of state I've got an exception of Authorization
denied on running that specific action. But the user that requires the
build has the permission to change that state and also the user running
the build.
I've also tried to put all grants on everyone and only then I can
change-state.
Both my user are in Project Area and Team Area.

Any idea??

On the Advanced Properties page in the admin web ui, you can configure
the user ID which will be used to execute all process change event
handlers.

In the admin web ui, click the Server link on the top 'toolbar', then
select Advanced Properties on the left. Finally, search for
"ProcessChangeEventsTask" to jump to the property.


--
Jared Burns
Jazz Process Team

0 votes


Permanent link
I've find out that the only way to perform the state change is that the operation of change-state permormed inside the event handler must be permitted by "Everyone" role. I can't define the permission to a specific role.
It seems a little bit wrong this behaviour, IMHO.

0 votes


Permanent link

On the Advanced Properties page in the admin web ui, you can configure
the user ID which will be used to execute all process change event
handlers.

In the admin web ui, click the Server link on the top 'toolbar', then
select Advanced Properties on the left. Finally, search for
"ProcessChangeEventsTask" to jump to the property.

Thank you for the answer. So has a user be defined, which has to be included, with specific role permission, on all the project area and team area? Or maybe is it better to use, as I said in previous reply, the Everyone role?

0 votes


Permanent link
Can you tell us more about your scenario? It seems strange to be making modifications to work items as a side effect of build events. Maybe this should be done as a build participant, or an Ant task as an explicit step in the build script.

0 votes


Permanent link
My intent is to perform a change-state after a successful build.
In this handler i wrote, I control the build status and if it is completed and successful I perform a query on the work item in a specific workflow state and than for all these I run a specific workflow action.

I'd like to exclude a specific role (I've call it "Administrators") for this handler so I was watching on how to do with built-in configuration. Thanks to Jared, I've found that the event handler is managed from ADMIN user (and I don't want to change it), so I have had to configure this handler on Everyone role instead of all the roles with the exception of "Administrator", and than I have used coding in the plugin to catch the requestor of the build using IBuildRequest.getInitiatingContributor() and than retrieving the role.

I don't know if there is another (better) way to do it.

0 votes


Permanent link
I think this kind of workflow transition would be better done as an explicit Ant task (contributed to the build toolkit), or as a post-build participant (see http://jazz.net/forums/viewtopic.php?p=22695).

Note that the initiating contributor will be ADMIN for a scheduled build.
To determine whether a build is a scheduled one (vs. manually requested), use IBuildResultRecord.isScheduledBuild(), where records are obtained from IBuildResultRecordClient on the client side. Its implementation, if you don't want to deal with records, is:

public boolean isScheduledBuild() {
for (IBuildRequest buildRequest : getBuildRequests()) {
if (buildRequest.getBuildAction().getAction().equals(IBuildAction.REQUEST_BUILD)) {
IBuildProperty property = buildRequest.getBuildDefinitionInstance().getProperty(
IBuildScheduleTaskProperties.PROPERTY_SCHEDULED_BUILD);
if (property != null) {
String value = property.getValue();
return Boolean.parseBoolean(value);
}
}
}
return false;
}


To get the request items, use IBuildResult.getBuildRequests() then fetch the items. Be sure to use a profile to fetch only the properties you need, as these items can be quite large (e.g. they include a copy of the build definition including all its properties).

0 votes


Permanent link
Hi, I'm facing the same problem.

I use event management in order to perform some action like saving wi attributes or delivering change-set. But I want to give permission on these operation only to a technical user, not to everyone. But even if I set my user on com.ibm.team.process.internal.service.ProcessChangeEventsTask instead of ADMIN, when my event extension runs, it has ADMIN as event author.

Any suggestion on how to change this user?

0 votes


Permanent link
Hi Michele,

The runAsUser setting is ignored (and has been since 1.0). Having the setting still there is admittedly confusing. I've filed 167352: ProcessChangeEventTask ignores runAsUser setting and cc'ed you.

If your event handler needs to run as a different user (perhaps the user can be recovered from the event), you can use com.ibm.team.repository.service.IImpersonationService to run code under a different user.

0 votes


Permanent link
Thank you very much.

This explain why I have never been able to set it. Now I'll take a look to the service you've suggested.

Best regards,
Michele.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Aug 27 '09, 9:42 a.m.

Question was seen: 7,988 times

Last updated: Aug 27 '09, 9:42 a.m.

Confirmation Cancel Confirm