Bot Access Policy
# support
n
Hi there! I'd like to have a bot that patients can execute directly using the $execute endpoint, that has access to more resources than the patient's access policy allows. To accomplish this, I've added an access policy to the Bot that allows the needed resources. The problem is that the access policy doesn't seem to have any effect on what the bot can access, it seems like the bot is just using the patient's token and access policy. Not sure what I'm doing wrong. Some info that may be helpful: Medplum version: 2.2.10 I'm self-hosting and using external lambda functions managed with SST Bot is NOT set to "Run as user" Resource section of the patient's access policy:
Copy code
json
{
  "resource": [
    {
      "resourceType": "Patient",
      "compartment": {
        "reference": "%patient"
      },
      "readonly": true
    },
    {
      "resourceType": "Task",
      "criteria": "Task?owner=%patient"
    },
    {
      "resourceType": "QuestionnaireResponse",
      "compartment": {
        "reference": "%patient"
      }
    },
    {
      "resourceType": "Encounter",
      "compartment": {
        "reference": "%patient"
      }
    },
    {
      "resourceType": "Bot",
      "readonly": true,
      "criteria": "Bot?identifier=bots|getPractitionerAvailability"
    }
  ]
}
Resource section of the bot's access policy:
Copy code
json
{
  "resource": [
    {
      "resourceType": "Schedule",
      "readonly": true
    },
    {
      "resourceType": "Appointment",
      "readonly": true
    }
  ]
}
149 Views