Uploaded image for project: 'Nuxeo Python Client'
  1. Nuxeo Python Client
  2. NXPY-220

Use a REST API call instead of Automation for Users.current_user()

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.0
    • Fix Version/s: 5.2.0
    • Component/s: Core

      Description

      There are several ways to retrieve informations about the logged user:

      • POST site/automation/login (Automation, currently used), it returns:
        {
          "entity-type": "login",
          "username": "Administrator",
          "isAdministrator": true,
          "groups": [
            "administrators"
          ]
        }
      • GET site/api/v1/me (REST API), it returns:
        {
          "entity-type": "user",
          "id": "Administrator",
          "properties": {
            "firstName": "",
            "lastName": "",
            "tenantId": null,
            "groups": [
              "administrators"
            ],
            "company": "",
            "email": "devnull@nuxeo.com",
            "username": "Administrator"
          },
          "extendedGroups": [
            {
              "name": "administrators",
              "label": "Administrators group",
              "url": "group/administrators"
            }
          ],
          "isAdministrator": true,
          "isAnonymous": false
        }

      Let's move to the GET approach, no need to POST data for such information.

      It will also fix the current behavior: as of now a User model is created, but the retrieved entity-type is login and not user, so the current object is lacking of data.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mschoentgen Mickaël Schoentgen
                Reporter:
                mschoentgen Mickaël Schoentgen
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m

                    PagerDuty

                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.