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

How to check for permission before save function call on server side

i have a plugin which will save the workitem and which will also change the state of workitem. but i have a role which is not allowed to save the workitem in particular state so when my function gets called i have a parameter actionId which is passed to save function which throws error because user dont have permission to save in that state. so i want a code which will check if role assigned to user has permission to save in that state or not. below is my code

IStatus saveWorkItem3 = workItemServer.saveWorkItem3(currentWorkItemObj,
workItemServer.resolveWorkItemReferences(currentWorkItemObj, monitor), targetStateActionId,
additionalSaveParameters);
if(!saveWorkItem3.isOK()){
String message = saveWorkItem3.getMessage();
}

before this function call i need to check

0 votes



One answer

Permanent link
My 2 cent.

You try to develop a follow up action (participant) that saves the work item. The work item save in the participant can fail.

A participant can only succeed or fail. If it fails, it provides a reason. A fail can prevent the operation. I do not recall, if there is a warning mode.

So you can fail and someone else have to change the state, or you ignore the problem. 

Another option might be to try to elevate the advisor into running in an administrative context. I do not know if that would help though, as the administration role does not grant permissions.  

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
× 7,604
× 1,733
× 1,433
× 169

Question asked: 5 hours ago

Question was seen: 22 times

Last updated: 1 hour ago

Confirmation Cancel Confirm