@wmfs/tymly-rbac-plugin

Plugin which provides role-based authentication

Usage no npm install needed!

<script type="module">
  import wmfsTymlyRbacPlugin from 'https://cdn.skypack.dev/@wmfs/tymly-rbac-plugin';
</script>

README

tymly-rbac-plugin

Tymly Plugin npm (scoped) CircleCI codecov CodeFactor Dependabot badge Commitizen friendly JavaScript Style Guide license

This plugin handles role based authentication

...

Install

$ npm install tymly-rbac-plugin --save

Add to your list of Tymly plugin's using

await tymly.boot({
  blueprintPaths: [
    ...
  ],
  pluginPaths: [
    path.resolve('@wmfs/tymly-rbac-plugin'),
    ...
  ]
},
...

The RBAC service will initialise itself from state machine restrictions. Users can be added to groups using the ensureUserRole methods, or by populating the role and role-membership tables.

Tymly's Statebox service is RBAC aware and so, if this plugin is loaded, will using this service to control access to state machines.

Methods

listUserRoles(userId)

checkAuthorization(userId, ctx, resourceType, resourceName, action)

ensureUserRoles(userId, roleIds)

refreshRbacIndex()

License

MIT