@iac-mchs/ngx-rule-role-access
v0.0.0
Published
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.7.
Downloads
1
Readme
NgxRbac
Roles and rules based access control library for angular version 1.
Installation
To install this library, run:
$ npm install @doce/ngx-rbac --save
Tools
Component
<do-provide-rules></do-provide-rules>
| Properties | Type | Description | | --- | --- | --- | | rules | DoStringDictionary<DoRuleType> | DoRuleType | Input a rules here to provide them on the current level | | roles | DoRuleType[] | Input a roles here to provide them on the current level |
Guard
DoCanGuard
| Arguments | Type | Description | | --- | --- | --- | | rules | string[] | The array of rule names |
Pipe
doCan
| Arguments | Type | Description | | --- | --- | --- | | rules | string | AllPossibleCheckers[] | AllPossibleCheckers | DoRuleType | Test criteria |
Functions
For Roles:
- doCreateRole(name: string): DoRoleType
For Permissions:
- doCreatePermission(name: string): DoRolePermissionType
- doCreatePermissions(names: string[]): DoRolePermissionType[]
For Rules:
doCreateRuleSet(ruleSet: DoRuleSet, options?: DoRuleOptions): DoStringDictionary<DoRule>
doCreateRule(name: string, checkers: AllPossibleCheckers[], options?:DoRuleOptions): DoRuleType
doExtendRule(name: string, checkers: AllPossibleCheckers[]): DoStringDictionary<DoRule>
doSimpleRule(name: string, options?:DoRuleOptions): { [name]: doCreateRule(name, [() => true], options) }
Logical:
doNot(checkers: AllPossibleCheckers, options: DoRuleOptions): DoRuleType
doOr(checkers: AllPossibleCheckers, options: DoRuleOptions): DoRuleType
doAnd(checkers: AllPossibleCheckers, options: DoRuleOptions): DoRuleType
Explanations
AllPossibleCheckers
DoRuleType | DoRoleType | DoCheckerFunction | string;
DoRuleSet
{
[ruleName: string]: AllPossibleCheckers[]
}
DoRuleOptions
{
absentRuleBehavior?: DoAbsentRuleBehavior;
groupName?: string;
}
DoCheckerFunction
(args: any[], dependency: Dependency) => boolean
Dependency
[DoRoleType[], DoStringDictionary<DoRuleType>]
DoRuleType
{
addPermissionsOf(child: DoRolePermissionType): void;
addRule(rule: DoRuleType | DoStringDictionary<DoRuleType>): void;
}
DoStringDictionary<T>
{
[key: string]: T;
}
DoRolePermissionType
{
can: DoStringDictionary<DoRuleType>;
canNames: string[];
name: string;
}