@inok/ngx-rbac
v1.0.4
Published
Forked angular library for RBAC
Downloads
4
Readme
NgxRbac
Roles and rules based access control library for angular version 1.
Installation
To install this library, run:
$ npm install @inok/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;
}