1 Reply Latest reply on Aug 25, 2015 6:38 AM by Ryan Rutan

    Is it possible to change all place ownership rights of an user by using the REST API?

    philipfehrenbacher

       

      I have the following scenario:

       

      If an employee leaves the company I would like to keep all of his content and identify in which groups, projects and spaces he had ownership rights to assign these rights to another person (e.g. his line manager).

      I tried to achieve that by using the REST API. That scenario consists out of three steps.

       

      1. Identify all places with ownerships rights of a certain user
      2. Give his line manager the same ownership rights
      3. Remove the ownership rights from the user

        

      I tried the following calls for step 1:

       

      Call: curl -v -u admin “http://jivehost:8080/api/core/v3/members/people/1”

      Result: includes only groups (no projects and no spaces)

       

      Call: curl -v -u admin "http://jivehost:8080/api/core/v3/places?filter=relationship(owner(http://jivehost:8080/api/core/v3/people/2002))"

      Result: includes only groups (no projects and no spaces)

       

       

      For step 2 and 3 I found the following restrictions in the API:

       

      API -> Places -> Groups -> Field -> Creator: Read-Only

      https://developers.jivesoftware.com/api/v3/cloud/rest/GroupEntity.html

       

      Why can I not update this field? Do you have a reason for that restriction?

       

      It is the same with projects:

      API-> Places -> Projects -> Field -> Creator: Read-Only

      https://developers.jivesoftware.com/api/v3/cloud/rest/ProjectEntity.html

       

       

       

      Do you have any idea if I could implement my scenario by using the current REST API?

       

        • Re: Is it possible to change all place ownership rights of an user by using the REST API?
          Ryan Rutan

          The first part of your request definitely makes sense.

           

          As User ABC, you should be able to get a list of groups where that use is an "Owner".

          /places?filter=relationship(owner)

           

          This should return all groups that the current user (credentials passed into the API call) is an Owner.

           

          Take this list and iterate over it...

           

          For each record, you could then spawn a request to createMember for that group and specify the new user as an owner.

          Jive REST API v3.12 → Member service

          Note: You could also batch these up into a single (or larger requests) using the Batch Service:

          Jive REST API v3.12 → Batch service

           

          Once the new user is an owner, you can then re-iterate over your previous batch and swap out the user ID and change from "Create" to "Destroy".  This will affectively "leave the group" from the user that is currently logged in.

           

          Since there is now an owner in each group, this shouldn't be a problem.

           

          Note:  Projects are definitely fickle.  They were introduced in Jive before our v3 API took hold, so it is likely that object (which isn't used all that often) may not have full coverage in the API beyond the general "place" stereotype.  In general, in the UI...projects can only have 1 owner which is unlike any other container in Jive.  In the UI though, you can change the owner through the project settings ... and as an owner of the group ... you have admin rights over the project (so you dont have to be listed as the owner) per say to administer it (if memory serves me correctly).

           

          Hope this helps.

          1 person found this helpful