|
|
## SHARED
|
|
## SHARED
|
|
|
|
|
|
|
|
Contains the decorators used by all controllers
|
|
Contains the decorators used by all controllers.
|
|
|
|
|
|
|
|
### Auth.Guard.ts
|
|
### Auth.Guard.ts
|
|
|
|
|
|
|
|
Basic guard for verifying user's tokens. Returns `false` if the authorization header is present or the jwt token is not valid. Halts the request in the controller, which throws an exception for `Http-Error-Filter`. The filter returns an error message for the client.
|
|
Basic guard for verifying user's token. Returns `false` if the authorization header is not present or the jwt token is not valid. Halts the request in the controller, which throws an exception for `Http-Error-Filter`. The filter returns an error message for the client.
|
|
|
|
|
|
|
|
The guard also modifies the request by adding the user's information from to token to it. This can be accessed by the [`UserDecorator`](./user#userdecoratorts) which passes it to the service.
|
|
The guard also modifies the request by adding the user's information from to token to it. This can be accessed by the [`UserDecorator`](./user#userdecoratorts) which passes it to the service.
|
|
|
|
|
|
| ... | @@ -16,7 +16,7 @@ The global error catcher. Denies any unhandled exceptions from happening in the |
... | @@ -16,7 +16,7 @@ The global error catcher. Denies any unhandled exceptions from happening in the |
|
|
|
|
|
|
|
### Roles.Guard.ts
|
|
### Roles.Guard.ts
|
|
|
|
|
|
|
|
An advanced guard for verifying user's role. The valid roles are passed with `@Roles()` decorator. If the roles array is empty for some reason, returns true. Returns `false` if the authorization header is present or the jwt token is not valid, same as in AuthGuard. Requires the game's UUID in the request's params. Uses class-validator to verify that the UUID is valid and throws an exception if it's not.
|
|
An advanced guard for verifying user's role. The valid roles are passed with `@Roles()` decorator. If the roles array is empty for some reason, returns true. Returns `false` if the authorization header is not present or the jwt token is not valid, same as in AuthGuard. Requires the game's UUID in the request's params. Uses class-validator to verify that the UUID is valid and throws an exception if it's not.
|
|
|
|
|
|
|
|
RolesGuard also adds the user's information in the request, but also adds the `gameperson` relation of the user. This can be accessed by the [`GamePersonDecorator`](./game#gamepersondecoratorts), which passes it to the service. The object contains the whole gameperson entry with it's relations to the `faction` and `group` entity.
|
|
RolesGuard also adds the user's information in the request, but also adds the `gameperson` relation of the user. This can be accessed by the [`GamePersonDecorator`](./game#gamepersondecoratorts), which passes it to the service. The object contains the whole gameperson entry with it's relations to the `faction` and `group` entity.
|
|
|
|
|
|
| ... | |
... | |
| ... | | ... | |