Skip to content

Commit 1b14f31

Browse files
Merge pull request #1624 from luxaritas/patch-1
docs(authorization): Improve consistency in PoliciesGuard example
2 parents 8827ecf + d273970 commit 1b14f31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/security/authorization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,9 @@ findAll() {
405405
Alternatively, we can define a class which implements the `IPolicyHandler` interface:
406406

407407
```typescript
408-
export class CreateArticlePolicyHandler implements IPolicyHandler {
408+
export class ReadArticlePolicyHandler implements IPolicyHandler {
409409
handle(ability: AppAbility) {
410-
return ability.can(Action.Create, Article);
410+
return ability.can(Action.Read, Article);
411411
}
412412
}
413413
```
@@ -417,7 +417,7 @@ And use it as follows:
417417
```typescript
418418
@Get()
419419
@UseGuards(PoliciesGuard)
420-
@CheckPolicies(new CreateArticlePolicyHandler())
420+
@CheckPolicies(new ReadArticlePolicyHandler())
421421
findAll() {
422422
return this.articlesService.findAll();
423423
}

0 commit comments

Comments
 (0)