Skip to content

Conversation

Meggielqk
Copy link
Collaborator

@Meggielqk Meggielqk added this to the 5.9.0 milestone Aug 11, 2025
@Meggielqk Meggielqk requested a review from savonarola August 11, 2025 07:09
@Meggielqk Meggielqk requested a review from id September 17, 2025 03:57
- Click the **Delete** button to remove a rule.

Rules are also managed through `/api/v5/authorization/sources/built_in_database` APIs.
### Create Authorization Rules via REST API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part seems to be mostly outdated...
The endpoints are

        "/authorization/sources/built_in_database/rules/users",
        "/authorization/sources/built_in_database/rules/clients",
        "/authorization/sources/built_in_database/rules/users/:username",
        "/authorization/sources/built_in_database/rules/clients/:clientid",
        "/authorization/sources/built_in_database/rules/all"

Also the API directly reflects the dashboard, there are three scopes: username, clientid and all.

To create rules, e.g. for a user, the request is the following:

curl 'http://localhost:18083/api/v5/authorization/sources/built_in_database/rules/users' \
- X POST \
...[headers]... \
  --data-raw '[{"username":"sdfs","rules":[{"topic":"sdfv","permission":"allow","action":"publish","qos":[0,1,2],"retain":"all"}]}]'

To update rules e.g. for a user:

curl 'http://localhost:18083/api/v5/authorization/sources/built_in_database/rules/users/sdfs' \
  -X 'PUT' \
... [headers]... \
  --data-raw '{"username":"sdfs","rules":[{"action":"publish","retain":"all","topic":"sdfvsdf","qos":[0,1,2],"permission":"allow"}]}'

For /authorization/sources/built_in_database/rules/all endpoint there is no PUT request, just POST updating/creating all the rules.

There is no such hing as scope & scope_value 🤔

Also see swagger doc on a running release-60 instance: http://localhost:18083/api-docs/index.html#/Authorization/put_authorization_sources_built_in_database_rules_users__username_

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.

2 participants