Rally Software

 View Only
  • 1.  Changing Userpermission

    Posted Sep 04, 2017 06:25 AM

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



  • 2.  Re: Changing Userpermission

    Posted Sep 04, 2017 06:43 AM


  • 3.  Re: Changing Userpermission

    Posted Sep 04, 2017 06:46 AM

    Avi12Apr2017

     

    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.

     

    Michael



  • 4.  Re: Changing Userpermission

    Posted Sep 04, 2017 08:07 AM

    Hi Michael,

     

    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.



  • 5.  Re: Changing Userpermission
    Best Answer

    Posted Sep 04, 2017 08:13 AM

    Avi12Apr2017,

     

    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);

     

    Hope that helps.

     

    Michael