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

Automatically declare parent permission groups #6324

Open
dktapps opened this issue Apr 5, 2024 · 1 comment
Open

Automatically declare parent permission groups #6324

dktapps opened this issue Apr 5, 2024 · 1 comment
Labels
Category: API Related to the plugin API Category: UI Related to the user interface (e.g. commands, terminal output) Type: Enhancement Contributes features or other improvements to PocketMine-MP

Comments

@dktapps
Copy link
Member

dktapps commented Apr 5, 2024

Description

Currently, the permission system doesn't make any assumptions about the strings used to identify permissions. However, in practice, permissions typically look like this: pocketmine.command.gamemode.self

However, if trying to set the permission pocketmine.command.gamemode to override all of the sub permissions, nothing will happen.

This issue proposes that . should be considered as a hierarchy separator by the internal system, and parent permission nodes automatically declared to allow users to get the expected behaviour.

This means that registering pocketmine.command.gamemode.self would generate the following hierarchy:

`pocketmine`
-> `pocketmine.command`
  -> `pocketmine.command.gamemode`
    -> `pocketmine.command.gamemode.self`

Alternative methods

@dktapps
Copy link
Member Author

dktapps commented Apr 10, 2024

This would also be useful for backwards compatibility purposes. Currently, if we want to divide an existing permission into sub permissions, the original permission declaration has to be explicitly retained, as seen here: 567bd8a#diff-28f7c5edac5d9f0ad9a1eabb7aada678eb60c4d2f8ca5da16a68acad45fb724c

This shouldn't be necessary, as the "deprecated" permission should be auto declared.

@dktapps dktapps added Category: API Related to the plugin API Type: Enhancement Contributes features or other improvements to PocketMine-MP Category: UI Related to the user interface (e.g. commands, terminal output) labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: API Related to the plugin API Category: UI Related to the user interface (e.g. commands, terminal output) Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

No branches or pull requests

1 participant