0.1.0 • Published 7 years ago
@mr-luke/vredux-auth v0.1.0
@mr-luke/vRedux
This is Authentication & Authorization module for VRedux apps.
Installation
npm install @mr-luke/vredux-auth
Basic Usage
import { VReduxModule, VReduxConfig } from '@mr-luke/vredux';
import { VAuthModule, vAuthReducer, vAuth } from '@mr-luke/vredux-auth';
const config-redux: VReduxConfig = {
reducers: { auth: vAuthReducer },
initState: {},
middlewares: { thunk, vAuth, logger }
}
@NgModule({
imports: [
BrowserModule,
VReduxModule.forRoot(config-redux),
VAuthModule
]
})
export class AppModule {}
VAuthModule provides VAuth service that contains 3 helper methods:
- check() -> check if user is authenticated
- canAccess(priv: string|number, level: number) -> check if user can access data, resource or ath we'd like to restrict
- canModify(model: any, name: string) -> check if user can modify data or resource.
Module API
Apears soon...
Contributing
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.