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??
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??
9 answers
On Thu, 27 Aug 2009 13:53:02 +0000, mikyjpeg wrote:
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
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
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?
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.
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.
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:
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).
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).
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?
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?
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.
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.