Integrated Permissions Module
What it is
The IPM is a set of functions that serve to authenticate command execution permissions for individual users. This task used to belong to some rudimentary role-checking code which was copied and pasted many times. However, with the introduction of fixed usernames in Discord, and the inflexibility of role-bound permissions (using the bot in more than one server requires the same role in those servers as well), work on another means of authorization is necessary.
##### Disclaimer: #####
Although the module was made to work with neeble's discord bot interface, it will be designed so that it can easily be used as a general solution for access control.
How it works
The module works under the concepts of access control lists applied in a table format with two columns: One contains the username, and the other contains a JSON-Formatted dictionary. This dictionary's key corresponds to a set of related commands, and its value is a list which contains the specific commands this user may be able to execute, a has access to all specific commands if the list contains a "*".
Example:
id|user|ipmlist |
--+----+-----------------------------------------------------------------------+
1|foo |{"mgmt": ["dbg", "version", "nf"], "news": ["readNews", "refreshNews"]}|
2|bar |{"mgmt": ["*"], "news": ["*"]} |
Where user foo can execute the dbg, version and nf commands, as well as the specific news-related managment commands. And bar has access to all commands under both mgmt and news categories.
How to help
You may git clone -b ipm git@brejela.club:neeble-club/neeble.git to start working on the IPM-enabled version of neeble-bot. You can also access its gitea page. You may ask me for org permissions to push your branch to the main repository.