pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

Automatically default sharedRunAsUserId for AA Task API in the Page Editor

Open twschiller opened this issue 1 year ago • 0 comments

Context

  • FLUP to https://github.com/pixiebrix/pixiebrix-extension/issues/7767#issue-2161405035
  • In the Page Editor, if possible, automatically default the sharedRunAsUserId to apitaskrunner API Task runner user
    • Can look up via the /users/ endpoint and filter by username
    • The user must have the "View Users" role to call the endpoint though
  • Add a custom control for the sharedRunAsUserId field
    • In the field description, include the copy "To automatically set the sharedRunAsUserId, ensure your user has the Admin > View Users role. Otherwise, contact your Control Room Admin to get the sharedRunAsUserId"

Open Questions

  • Instead of defaulting it in the Page Editor, if it's left off, we could have the API Task running try to fetch it dynamically when the brick is run. The downside is each API Task would then require 2 API calls, and the caller would need the "View Users" Admin permission
  • How do we want the field to be defaulted? Add a button to the field that the user can click to try to default it?
  • We may use a CreateableSelect here?

Reference

Payload for /v2/usermanagement/users/list to find the apitaskrunner username. (We might want eq instead of substring for operator?)

{
  "sort": [
    {
      "field": "username",
      "direction": "asc"
    }
  ],
  "filter": {
    "operator": "substring",
    "value": "apitaskrunner",
    "field": "username"
  }
}

twschiller avatar Mar 01 '24 18:03 twschiller