1.1.1 • Published 5 years ago

@vestify/type-orm-rbac v1.1.1

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Type Orm RBAC

Build Status Coverage Status Depfu Maintainability

What Is It?

type-orm-rbac is a module that makes setting up users with RBAC in your Vestify project easy.

Usage

Installation

npm i @vestify/type-orm-rbac

You'll need to run applicable TypeORM migrations against your database to make use of the RBAC module. Migrations to add the necessary tables are found under dist/migrations. These migrations will add applicable tables for users, roles and permissions so that type-orm-rbac can retrieve permissions for a given user based on their assigned roles. It also adds the 'Super Admin' role which can be given to a user so that they can perform any action on any resource. This allows you to have at least one user who can perform CRUD actions against your RBAC tables via API to populate your app with necessary roles and permissions.

Once migrations have been run and your database is ready, just use the retrieveUserPermissions function exported by type-orm-rbac as your UserPermissionsRetriever for your instance of Vestify.

To compare a value in an object to the current user's ID when determining permission conditions, use the 'USER_ID' keyword for the strategy_test_value column in the applicable permission condition record. At runtime, the keyword 'USER_ID' will be replaced by the user ID. This allows you to provide specific permissions based on a user's ID, for example allowing a user to only edit article resources where an author_id equals their ID.

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago