Skip to content

Commit

Permalink
docs: update docs generator
Browse files Browse the repository at this point in the history
  • Loading branch information
SkeLLLa committed Jun 18, 2021
1 parent e543d2b commit e7b061f
Show file tree
Hide file tree
Showing 25 changed files with 479 additions and 463 deletions.
65 changes: 1 addition & 64 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1 @@
[fast-rbac](README.md)

# fast-rbac

## Index

### Classes

* [RBAC](classes/rbac.md)

### Variables

* [SEPARATOR](README.md#const-separator)

### Functions

* [flatten](README.md#private-flatten)
* [mergeRoles](README.md#private-mergeroles)

## Variables

### `Const` SEPARATOR

**SEPARATOR**: *":"* = ":"

Defined in index.ts:3

## Functions

### `Private` flatten

**flatten**(`object`: object, `separator`: string): *object*

Defined in utils.ts:4

**Parameters:**

Name | Type | Default |
------ | ------ | ------ |
`object` | object | - |
`separator` | string | "." |

**Returns:** *object*

* \[ **key**: *string*\]: any

___

### `Private` mergeRoles

**mergeRoles**(`dst`: object, ...`srcs`: Array‹object›): *object*

Defined in utils.ts:42

**Parameters:**

Name | Type |
------ | ------ |
`dst` | object |
`...srcs` | Array‹object› |

**Returns:** *object*

* \[ **key**: *string*\]: any
Fast RBAC - v1.3.0 / [Modules](modules.md)
149 changes: 149 additions & 0 deletions docs/classes/index.rbac-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
[Fast RBAC - v1.3.0](../README.md) / [Modules](../modules.md) / [index](../modules/index.md) / RBAC

# Class: RBAC

[index](../modules/index.md).RBAC

RBAC classref

## Table of contents

### Constructors

- [constructor](index.rbac-1.md#constructor)

### Methods

- [add](index.rbac-1.md#add)
- [can](index.rbac-1.md#can)
- [remove](index.rbac-1.md#remove)

## Constructors

### constructor

**new RBAC**(`options?`)

RBAC constructor

#### Parameters

| Name | Type | Description |
| :-------- | :--------------------------------------------- | :----------- |
| `options` | [Options](../interfaces/index.rbac.options.md) | RBAC options |

#### Defined in

[index.ts:44](https://github.com/SkeLLLa/fast-rbac/blob/e543d2b/src/index.ts#L44)

## Methods

### add

**add**(`role`, `resource`, `operation`, `when?`): `void`

Adds new role to rules.

**`version`** 1.1.X

#### Parameters

| Name | Type | Description |
| :---------- | :---------------------------------------------- | :----------------------------- |
| `role` | `string` | user role |
| `resource` | `string` | resource to access |
| `operation` | `string` | allowed operation |
| `when?` | [WhenFn](../modules/index.rbac.md#whenfn)<any\> | function for additional checks |

#### Returns

`void`

#### Defined in

[index.ts:95](https://github.com/SkeLLLa/fast-rbac/blob/e543d2b/src/index.ts#L95)

---

### can

**can**(`role`, `resource`, `operation?`): `boolean`

Checks if user can perform operation without checking when condition.

**`version`** 1.X.X

#### Parameters

| Name | Type | Description |
| :----------- | :------- | :-------------------- |
| `role` | `string` | user role |
| `resource` | `string` | resource to access |
| `operation?` | `string` | operation on resource |

#### Returns

`boolean`

true if role has access to resources

#### Defined in

[index.ts:153](https://github.com/SkeLLLa/fast-rbac/blob/e543d2b/src/index.ts#L153)

**can**<TContext\>(`role`, `resource`, `operation`, `context`): `Promise`<boolean\>

Checks if user can perform operation with checking when condition if it's provided.

**`version`** 1.X.X

#### Type parameters

| Name | Type |
| :--------- | :----------------- |
| `TContext` | `TContext` = `any` |

#### Parameters

| Name | Type | Description |
| :---------- | :--------- | :---------------------------------------------- |
| `role` | `string` | user role |
| `resource` | `string` | resource to access |
| `operation` | `string` | operation on resource |
| `context` | `TContext` | context passed to when function, set it to null |

#### Returns

`Promise`<boolean\>

true if role has access to resources.

#### Defined in

[index.ts:165](https://github.com/SkeLLLa/fast-rbac/blob/e543d2b/src/index.ts#L165)

---

### remove

**remove**(`role`, `resource?`, `operation?`): `void`

Remove rule(s).

**`version`** 1.1.X

#### Parameters

| Name | Type | Default value | Description |
| :---------- | :------- | :------------ | :----------------- |
| `role` | `string` | `undefined` | user role |
| `resource` | `string` | '\*' | resource to access |
| `operation` | `string` | '\*' | operation |

#### Returns

`void`

#### Defined in

[index.ts:116](https://github.com/SkeLLLa/fast-rbac/blob/e543d2b/src/index.ts#L116)
163 changes: 0 additions & 163 deletions docs/classes/rbac.md

This file was deleted.

17 changes: 17 additions & 0 deletions docs/interfaces/index.rbac.operationrules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Fast RBAC - v1.3.0](../README.md) / [Modules](../modules.md) / [index](../modules/index.md) / [RBAC](../modules/index.rbac.md) / OperationRules

# Interface: OperationRules

[index](../modules/index.md).[RBAC](../modules/index.rbac.md).OperationRules

Operation permission list.

## Indexable

[operationName: `string`]: `boolean` \| [WhenFn](../modules/index.rbac.md#whenfn)

Operation permission.

**`description`** `true` if allowed or `function` if need additional dynamic checks

**`see`** [RBAC.WhenFn](../modules/index.rbac.md#whenfn)
Loading

0 comments on commit e7b061f

Please sign in to comment.