hll_rcon_tool icon indicating copy to clipboard operation
hll_rcon_tool copied to clipboard

Include required permissions by endpoint in `get_api_documentation`

Open cemathey opened this issue 1 year ago • 0 comments

  • Creates our own permission_required decorator which just passes through to Django's method so that we can track which permissions are required by endpoint
  • Include the permission(s) required in get_api_documentation to make it easier to determine which access a user requires to consume the API (whether through a tool or the UI)

Output looks like:

 {
      "endpoint": "add_admin",
      "arguments": {
        "player_id": {
          "default": null,
          "annotation": null
        },
        "role": {
          "default": null,
          "annotation": null
        },
        "description": {
          "default": null,
          "annotation": null
        }
      },
      "return_type": "<class 'bool'>",
      "doc_string": null,
      "auto_settings_capable": true,
      "permissions_required": [
        "api.can_add_admin_roles"
      ],
      "allowed_http_methods": [
        "POST"
      ]
    },

cemathey avatar Oct 08 '24 20:10 cemathey