Add user via Process REST API
Hi,
I have been working with the process rest api and I see that I can add users doing a post request to members collections, but seems that it only works if I am a administrator in the project area no matter if I have JazzAdmin repository permission, I don't know why this happens, I got this error when I'm trying to do it.
Name: Save Project AreaAs JazzAdmin user I can add users via web in all project areas even if I'm not the administrator of them.
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 collection of team members (modify/members)
Severity: ERROR
Does anybody knows if there is another way to add the user using the process api without been an administrator of the project area?
I will give you an example of what I'm doing.
curl -k -b cookie.txt -c cookie.txt https://myserver/jts/authenticated/identitycurl -X POST --anyauth -k -L -b cookie.txt -c cookie.txt -d "j_username=myuser" -d "j_password=$pass" https://myserver/jts/authenticated/j_security_checkcurl -D - -k -b cookie.txt -H "Content-Type: application/xml" -X POST --data-binary @user.xml https://myserver/ccm/process/project-areas/_m8GiUJyaEeCCOpmJEcOfKQ/members
my user.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?><jp06:members xmlns:jp06="http://jazz.net/xmlns/prod/jazz/process/0.6/"><jp06:member><jp06:user-url>https://myserver/jts/users/anyuser@domain.com</jp06:user-url><jp06:role-assignments><jp06:role-assignment><jp06:role-url>https://myserver/rm/process/project-areas/_ObqWkrxQEeCyof5XwVHN7A/roles/Administrator</jp06:role-url></jp06:role-assignment><jp06:role-assignment><jp06:role-url>https://myserver/rm/process/project-areas/_ObqWkrxQEeCyof5XwVHN7A/roles/Author</jp06:role-url></jp06:role-assignment><jp06:role-assignment><jp06:role-url>https://myserver/rm/process/project-areas/_ObqWkrxQEeCyof5XwVHN7A/roles/Commenter</jp06:role-url></jp06:role-assignment><jp06:role-assignment><jp06:role-url>https://myserver/rm/process/project-areas/_ObqWkrxQEeCyof5XwVHN7A/roles/ProjectSnapshotAdministrator</jp06:role-url></jp06:role-assignment><jp06:role-assignment><jp06:role-url>https://myserver/rm/process/project-areas/_ObqWkrxQEeCyof5XwVHN7A/roles/default</jp06:role-url></jp06:role-assignment></jp06:role-assignments></jp06:member></jp06:members>
Thank you.
One answer
You need to add yourself as the Project Administrator, at least temporarily. The exact same issue was discussed in the below post (do check out the other posts linked in the post).
https://jazz.net/forum/questions/222872/adding-user-as-project-area-administrator-with-api