This repository has been archived by the owner on Jun 5, 2022. It is now read-only.
Releases: rpitv/glimpse-permissions
Releases · rpitv/glimpse-permissions
v0.1.3 - Add PermissionTools
This release adds a few extra tools to make dealing with permissions easier.
globalStack
- This is aPermissionTreeStack
which is global throughout the running process. This makes accessing it from anywhere easier, and allows for easier interaction between libraries.formatScope()
- Format a scope string with variables.- In many cases this could be replaced with template literals, however this method allows for more strict formatting and simplified re-use of variables.
assertPermission()
- Assert that the global permission tree stack evaluates a given permission scope to ALLOW. If not, then an error is thrown, which can be handled upstream.AccessDeniedError
- Extension of Error which takes in a scope instead of a message.
v0.1.2 - Update README.md
The repository had changes to its Github workflow. It's necessary to publish a new release to update the README with the new badges.
v0.1.1 - Remove Unnecessary files from Publish
- Remove .eslintcache from published package
v0.1.0 - Initial Release
This is the initial release of this project.
Features
PermissionScope
class
- Target your permissions to specific subsections of applications/tools.
- Scopes are formatted as
tierOne:tierTwo:tierThree:...
- Scopes support wildcards for tiers, however wildcards cannot be combined with other text.
- e.g.,
sample:*:scope
has a wildcard in tier two, butsample:*substring*:scope
does not.
- e.g.,
PermissionState
enum
- Permissions can have three states:
ALLOW
,DENY
, orNONE
to inherit.
Permission
class
- Permissions are essentially just a way to pair a PermissionScope to a PermissionState.
PermissionTree
class
- Group permissions together logically based off of user or group, for example.
- Permissions have a specific order to how they are evaluated, and rules for how it is determined whether one permission has priority over another in the event of conflicts.
PermissionTreeStack
class
- Stack multiple PermissionTrees on top of each other.
- Useful when dealing with multiple permission trees applied to one user.
- e.g., user is in multiple groups, or user is "mimicking" another user/group to see what they see with their permissions.
- PermissionTreeStacks return the first matching Permission's state, or
NONE
if no PermissionTrees match.- In other words, the priority rules used in
PermissionTree
s do not apply toPermissionTreeStack
s.
- In other words, the priority rules used in