New Major Version
Note: This is the same as v2.0.0-beta.0
, just promoting it to the latest release.
After 5 years with no code changes, I've finally updated this code! This is a very thorough rework of the entire API and should make it good for another five years! (It should be noted that I've been using v1.0.0
in production at various jobs since release, and never once had an issues with it.)
Features
- 100% conversion to TypeScript!
- 0 production dependencies! (Removed
lodash
andbluebird
) - Simplified code.
- Simplified usage.
We've converted the entire code base over to TypeScript and removed all production dependencies. No longer will you have to pull in lodash packages or Bluebird. This should make the overall code size smaller.
Breaking Changes
- Object permissions removed.
- Two part permission form removed.
loadGroup()
is no longer asynchronous.loadGroup()
no longer takes a function or promise.
Deprecations
*/*
is considered deprecated, use*
for 'match all permissions'.
Over the last five years of usage, the two part form of hasPerm('somePerm', 'someObj')
was one of the least used, most confusing APIs in the system. The "object level permissions" implementation wasn't great in general, and the single string Object/permission
was added as a work around for how awkward it was. Because of that, we've just removed it. If you were using the single string version, that should still work, though now it reads the string as a literal value.
Note: We have limited legacy support for permissions defined as */somePerm
being checked with just somePerm
. We also support */*
as well as simply *
for admin permissions.
Additionally, with the proliferation of async
/await
in all major browsers, all LTS versions of node and the entire ecosystem, we've dropped support for loadGroups()
resolving the promise for you. To convert, simply await
your previous call.
The same is true for resolving a function; it's easy enough to simple call the function in the call to loadGroups
. There's no reason for loadGroups()
to support calling functions itself.