Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include required permissions by endpoint in get_api_documentation #720

Open
wants to merge 2 commits into
base: frontend/mui-v5
Choose a base branch
from

Conversation

cemathey
Copy link
Collaborator

@cemathey cemathey commented Oct 8, 2024

  • 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"
      ]
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant