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

Can not save Work Item due to permission issue

I'm trying to use RTC Plain JAVA API to create a defect.
  
I have the permission to create a defect from UI.
But I've got following error when I have set values and save a defect work item.  

Does the following error mean I don't have the permission to create a defect by API? Thanks.

com.ibm.team.process.common.advice.TeamOperationCanceledException : CRJAZ6053E The 'Save Work Item' operation cannot be completed. Permission is required to complete the operation.
      at com.ibm.team.process.internal.common.advice.runtime.OperationAdviceManager.advise( OperationAdviceManager.java:387 )
...
 
Name: Save Work Item
      ID: com.ibm.team.workitem.operation.workItemSave
      Severity: ERROR
            Name: Required Properties
            ID: com.ibm.team.workitem.advisor.requiredProperties
            Severity: OK
            Name: Required Approvals
            ID: com.ibm.team.workitem.advisor.requiredApprovals
            Severity: OK
            Name: All Children Resolved
            ID: com.ibm.team.workitem.advisor.allChildrenClosed
            Severity: OK
            Name: Save Project Area
            ID: com.ibm.team.process.server.saveProjectArea
            Severity: ERROR
                  Summary: Permission Denied
                  Description: You don't have permission to perform the following actions:
  Modify the process specification (modify/specification)
                  Severity: ERROR
                  Name: Avoid saving private roles
                  ID: com.ibm.ics.scm.rtc.privateroles.project
                  Severity: OK

sam detweiler replied me in another question.

Looks like you are trying to save the project area.. not just the workitem 

ID: com.ibm.team.process.server.saveProjectArea 

But I believe I'm saving a work item(defect), don't know why it triggered the saveProjectArea. Following is the related code. And I have used the similar code to save a work item(task) successfully. Confused.

Any tips? Thanks a lot.
private static class WorkItemInitialization extends WorkItemOperation {
private String fSummary;
private ICategoryHandle fCategory;
private IIterationHandle fIteration;
HashMap<iattribute, Object=""> fAttributes;
public WorkItemInitialization(String summary, ICategoryHandle category, IIterationHandle iteration, HashMap attributes) {
super("Initializing Work Item");
fSummary= summary;
fCategory= category;
fAttributes = attributes;
fIteration = iteration;
}
@Override
protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException {
IWorkItem workItem= workingCopy.getWorkItem();
workItem.setHTMLSummary(XMLString.createFromPlainText(fSummary));
workItem.setCategory(fCategory);

workItem.setTarget(fIteration); 
Iterator keys = fAttributes.keySet().iterator();
while(keys.hasNext()){
IAttribute key = (IAttribute)keys.next();
Object value = fAttributes.get(key);
workItem.setValue(key, value);
}
}
}
.....


String repositoryURI= "https://xxx.ibm.com:8001/jazz/";
String userId= "XXXX";
String password= "YYYY";
String projectAreaName= "Lotus Connections";
String typeIdentifier= "defect";

String summary = "Post install bvt";
String categoryName= "Web/Cross Functional/Automation";//args[6];//filedAgainst
String plannedFor = "Main development/Release Backlog/2014 Development";//required by task, defect
String foundIn = "Automated BVT";//required by defect
String qaTeam = "Functional (FVT)";//required by defect
String phaseFound = "Functional (FVT)";//required by defect
...
 
IWorkItemType workItemType= workItemClient.findWorkItemType(projectArea, typeIdentifier, null);
if (workItemType == null) {
System.out.println("Work item type not found.");
return false;
}
....

IAttribute phaseAttribute = workItemClient.findAttribute(projectArea, "howfound", null);
Identifier literalID_phase = null;
IEnumeration enumeration_phase =workItemClient.resolveEnumeration(phaseAttribute, null);
List literals_phase = enumeration_phase.getEnumerationLiterals();
for (Iterator iterator = literals.iterator(); iterator.hasNext();) {
ILiteral iLiteral = (ILiteral) iterator.next();
if (iLiteral.getName().equals(phaseFound)) {
literalID_phase = iLiteral.getIdentifier2();
System.out.println("You found phase!!");
break;
}
}
if(literalID_phase==null){
System.out.println("not found phase");
return false;
}
attributes.put(foundInAttribute, foundIN);
attributes.put(qaAttribute, literalID);
attributes.put(phaseAttribute, literalID_phase);
...

WorkItemInitialization operation= new WorkItemInitialization(summary, category, cih, attributes);
IWorkItemHandle handle= operation.run(workItemType, null);
IWorkItem workItem= auditableClient.resolveAuditable(handle, IWorkItem.FULL_PROFILE, null);
System.out.println("Created work item " + workItem.getId() + ".");

0 votes



2 answers

Permanent link
I agree with Sam but I am not sure why it happens either.

My suggestion would be to create your own test system where you can modify the permissions, get your code to work and then try it a gain on the current project area and find out what the difference is.

0 votes


Permanent link
I suspect its the Planned For value.  I have seen a similar error when importing workitems that have a Planned For value that does not yet exist in the Project Area.  The work item creation is attempting to add the Planned For value you specify to the project area but is failing because you don't have a role with permission to do that.  Note that children iterations of the out of the box "Main Development" timeline should start with "development/..." not "Main development/..." as you have.
Try
String plannedFor = "development/Release Backlog/2014 Development";//required by task, defect
instead.   

0 votes

Comments

good catch... I had this problem on import (the extra iterations and categories were created)..  I had admin so no error.

see the actual label string for the iterations.

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,934
× 411
× 169

Question asked: Dec 05 '14, 3:30 a.m.

Question was seen: 6,389 times

Last updated: Dec 07 '14, 8:57 p.m.

Confirmation Cancel Confirm