I have created a new User in Rally under workspace 2 with all projectpermission to Viewer Role.
Now I have a requirement to change the projectpermission for the same user under same workspace to Editor Role.
Can somebody help to write the java code?
Thanks in Advance.....
There is a sample available here: rally-java-rest-apps/createProjectPermissions at master · nmusaelian-rally/rally-java-rest-apps · GitHub
Hope that helps.
There is also an example here, Java Rally Rest Api : How to add new user to the Project - Stack Overflow . I have not tested both of these, but hopefully they will help get you going.
Thanks for your reply. But,I have already created the projectpermission for a user with Viewer Role.
I have a requirement to change the current Viewer Role to Editor Role for the same(i.e Existing) user.
These examples do just what you are requesting. You fetch the already created user and create a new Editor Project Permission for the User. Once it is created the user will have Editor for the Project.
It is specifically these lines of code:
// Create the new ProjectPermission for the User JsonObject newProjectPermission = new JsonObject(); newProjectPermission.addProperty("Workspace", workspaceRef); newProjectPermission.addProperty("Project", projectRef); newProjectPermission.addProperty("User", userRef); newProjectPermission.addProperty("Role", PROJECT_EDITOR); // PROJECT_EDITOR was set in a previous part of the code, but it is "Editor"
CreateRequest createProjectPermissionRequest = new CreateRequest("ProjectPermission", newProjectPermission);CreateResponse createProjectPermissionResponse = restApi.create(createProjectPermissionRequest);