authsome
Advanced tools
Flexible team-based authorization
Weekly downloads
Readme
Flexible team-based authorization module. This software is in an alpha stage.
Authsome is team-based, which means that authorization is determined based on team membership. A team consists of a group of members and belongs to one of the at team types configured at load time. A team is always based around an object (the object of the authorization request). A team can also be conditionally active, i.e. only active if the current state of the object matches the requirement for team activation. Best to explain this in an example. See Science Blogger mode example below.
Modes are exchangeable mechanisms of authorization (e.g. built in example modes: blog, journal, and noon).
If Authsome configuration is:
let config = {
mode: require('./src/modes/blog'),
teams: {
teamContributors: {
name: 'Contributors',
permissions: 'create'
},
teamCoauthors: {
name: 'Coauthors',
permissions: 'update'
}
}
}
Then Authsome can be created like so:
let authsome = new Authsome(
config.mode,
{ teams: config.teams }
)
And then used like so:
authsome.can(user, operation, object)
or:
authsome.can(currentUser, 'update', fragment)
The currently configured modes then take over and decide on the authorization, returning true or false.
In Science Blogger, we have two types of teams. One is a 'contributor' type, which allows you to create blogposts for the blog. The other is a 'coauthor' team type, which allows you to update a specific blogpost (write it with someone). There is no conditional activity of teams, and only these two team types.
When your managing teams, you create a new team with a certain type, and a certain object (in the case of Contributors, you would chose the blog object as the object of the team). You can then add members to this team, and those members can then ask (and receive) authorization to create blogposts for the blog.
Authsome can be used on both the backend (for authorizing API requests, e.g. for creating collections in PubSweet), and frontend (for showing/hiding UI that relates to an authorization request, e.g. a Create Blogpost button.)
FAQs
Flexible team-based authorization
The npm package authsome receives a total of 491 weekly downloads. As such, authsome popularity was classified as not popular.
We found that authsome demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.