An opinionated, but simple library for LuckPerms-like authorization using permission nodes.
Find a file
2025-03-31 20:37:34 +04:00
src inital commit 2025-03-31 20:37:34 +04:00
.gitignore inital commit 2025-03-31 20:37:34 +04:00
Cargo.lock inital commit 2025-03-31 20:37:34 +04:00
Cargo.toml inital commit 2025-03-31 20:37:34 +04:00
LICENSE-APACHE inital commit 2025-03-31 20:37:34 +04:00
LICENSE-MIT inital commit 2025-03-31 20:37:34 +04:00
README.md inital commit 2025-03-31 20:37:34 +04:00

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.