Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wmfs/tymly-rbac-plugin

Role Based Access Control support plugin
https://github.com/wmfs/tymly-rbac-plugin

plugin rbac tymly

Last synced: 3 months ago
JSON representation

Role Based Access Control support plugin

Awesome Lists containing this project

README

        

# tymly-rbac-plugin
[![Tymly Plugin](https://img.shields.io/badge/tymly-plugin-blue.svg)](https://tymly.io/)
[![npm (scoped)](https://img.shields.io/npm/v/@wmfs/tymly-rbac-plugin.svg)](https://www.npmjs.com/package/@wmfs/tymly-rbac-plugin)
[![CircleCI](https://circleci.com/gh/wmfs/tymly-rbac-plugin.svg?style=svg)](https://circleci.com/gh/wmfs/tymly-rbac-plugin)
[![codecov](https://codecov.io/gh/wmfs/tymly-rbac-plugin/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/tymly-rbac-plugin)
[![CodeFactor](https://www.codefactor.io/repository/github/wmfs/tymly-rbac-plugin/badge)](https://www.codefactor.io/repository/github/wmfs/tymly-rbac-plugin)
[![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/tymly-rbac-plugin/blob/master/LICENSE)

> This plugin handles role based authentication

...

## Install
```bash
$ 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](https://github.com/wmfs/tymly/blob/master/LICENSE)