Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamena2020 committed Feb 8, 2023
1 parent f8bc22e commit 6fb7944
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ Boilerplate backend for nodejs.

# Role and Permissions

A User model can have a role by binding using `hasRole(YourModel)` function inside `loadModels()` on `core/model/models.js` file.
A User model can have a role by binding using `hasRole(YourModel)` function inside `loadModels()` in `core/model/models.js` file.

```
Expand All @@ -444,7 +444,7 @@ Boilerplate backend for nodejs.

- Set users role

If the user already has a role, then the user role will be replaced with a new role. `YourModel.setRole(params)` params can be role id or name.
If the user already has a role, then the user role will be replaced with a new role. `YourModel.setRole(params)` params can be role `id` or `name`.

```
Expand Down Expand Up @@ -487,7 +487,6 @@ Boilerplate backend for nodejs.
```
user.removeRole()
```

Expand All @@ -497,7 +496,6 @@ Boilerplate backend for nodejs.
if (!GateAccess(user, ["user-create","user-stored","user-access"])) return res.sendStatus(403)
```

- Add permissions
Expand All @@ -517,7 +515,6 @@ Boilerplate backend for nodejs.
await Permission.create({ name: permission })
}
```

- Add Role
Expand All @@ -534,7 +531,7 @@ Boilerplate backend for nodejs.

- Assigning Permissions to Roles

Assign permissions to a role can be a list of permissions name or id.
Assign permissions to a role can be a list of permissions `name` or `id`.

```
Expand Down Expand Up @@ -691,7 +688,7 @@ Boilerplate backend for nodejs.

- Regenerate access token

Regenerate access token by calling `JwtAuth.regenerateAccessToken()`, that will return new access token.
Regenerate access token by calling `JwtAuth.regenerateAccessToken(refreshToken)`, that will return new access token.

```
Expand All @@ -709,7 +706,7 @@ Boilerplate backend for nodejs.
```

Or you just setup the env `AUTH_GET_CURRENT_USER_ON_REQUEST=true` and you can access current authenticated by access
Or you just setup the env `AUTH_GET_CURRENT_USER_ON_REQUEST=true` and you can access current authenticated user by access
`req.user`


Expand Down

0 comments on commit 6fb7944

Please sign in to comment.