An opinionated, but simple library for LuckPerms-like authorization using permission nodes.
src | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |
dotperms
An opinionated, but simple library for LuckPerms-like authorization using permission nodes.
Rules of the algorithm.
- This function MUST NOT return a [
Result
]. All of it's behaviour in response to invalid permissions nodes MUST be deny-first. Any invalid permissions MUST be ignored and any invalid requirements MUST be impossible to satisfy. - Any given permission MUST allow any other requirements under the same jurisdiction.
- Any given permission with any amount of context should only allow requirements with the same context values.
- The "" permission node MUST NOT allow ANY requirements. This is a conscious choice by the developer of the library in order to prevent an accidentally placed empty string into the permissions of a user, which will result in him getting access to everything in a given system.
- The "*" permission part MUST allow all requirements below itself, BUT the rules of context apply.
- The "" or "*" permission parts and anything that follows it MUST be cut off.
- Any permission part that contains "", but is not exactly "" MUST be considered empty.
From the LuckPerms Github Wiki:
A permission is just a string, and is separated into parts using periods. For example, “minecraft.command.ban” is the permission for the /ban command. Obviously we don’t want all users to have access to this, so we only give it to users we trust.
The string that represents a certain permission is also sometimes called a “permission node” or just “node” for short.
Context in the most basic sense simply means the circumstances where something will apply.
A single "context" consists of a key and a value, and are represented in the form key=value.