Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-91512

As a developer, I can obtain segment users using a headless API

    Details

      Description

      Create a headless API to retrieve the users of a given segment.

      To try this:

      curl -u username:password -D - http://localhost:8080/o/headless-admin-user/v1.0/segments/{segment-id}/user-accounts
      

      For example:

      If you use an admin user, the user can see all the users of the segment:

      curl -u test@liferay.com:test -D - http://localhost:8080/o/headless-admin-user/v1.0/segments/37035/user-accounts
      
      {
        "items" : [ {
          "email" : "kate.williams@liferay.com",
          "id" : 37005,
          "name" : "Kate Williams"
        }, {
          "email" : "test@liferay.com",
          "id" : 20139,
          "name" : "Test Test"
        } ],
        "lastPageNumber" : 1,
        "page" : 1,
        "pageSize" : 20,
        "totalCount" : 2
      }
      

      If you use a regular user that doesn't have the permission to view users, the user can only see itself:

      curl -u kate.williams@liferay.com:kate -D - http://localhost:8080/o/headless-admin-user/v1.0/segments/37035/user-accounts
      
      {
        "items" : [ {
          "email" : "kate.williams@liferay.com",
          "id" : 37005,
          "name" : "Kate Williams"
        } ],
        "lastPageNumber" : 1,
        "page" : 1,
        "pageSize" : 20,
        "totalCount" : 1
      }
      

      Tests

      Acceptance Criteria

      • If the user introduces the wrong endpoint, 404 error shows up.
      • If the user introduces the wrong credentials to the request, 403 error shows up.
      • If the user introduces a not exiting segmentId, the API retrieves an empty list.
      • As an admin user, I can list all the users of the segment.
      • As a regular user, I can list my user but I can't see other users.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  Master