It's all about the answers!

Ask a question

How can I temporarily "sudo" to another user in a


Stephen Hunt (81112) | asked Jul 05 '11, 3:27 p.m.
JAZZ DEVELOPER
In a follow-up plugin I need the user who performed the save on the WI to temporarily gain more permissions and perform actions in the plugin; reverting back to normal permissions on plugin termination.

2 answers



permanent link
Michele Pegoraro (1.8k14119103) | answered Jul 06 '11, 9:48 a.m.
Hi,
I think you can try to use com.ibm.team.repository.service.IImpersonationService to run some code under a different user.

Michele.

permanent link
SEC Servizi (97123760) | answered May 15 '13, 9:51 a.m.
You can use the "com.ibm.team.repository.service.IImpersonationService" service:
IContributorHandle contributorH = ...
IImpersonationService impersonationService = getService(IImpersonationService.class);
impersonationService.runAs(contributorH, new IImpersonationService.ImpersonationRunnable() {
public void run() throws Exception {
// ...
}
);
Be aware of the logged-in contributor must have administrator permissions.

Your answer


Register or 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.