Skip to content

Commit

Permalink
Fix docs (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
luizcmarin authored May 22, 2024
1 parent 94ecbb2 commit e74beb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://github.com/yiisoft" target="_blank">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px" alt="Yii">
</a>
<h1 align="center">Yii Role-Based Access Control</h1>
<br>
Expand Down Expand Up @@ -42,10 +42,10 @@ One of the following storages could be installed as well:

- [PHP storage](https://github.com/yiisoft/rbac-php) - PHP file storage;
- [DB storage](https://github.com/yiisoft/rbac-db) - database storage based on [Yii DB](https://github.com/yiisoft/db);
- [Cycle DB storage](https://github.com/yiisoft/rbac-cycle-db) - database storage based on
- [Cycle DB storage](https://github.com/yiisoft/rbac-cycle-db) - database storage based on
[Cycle DBAL](https://github.com/cycle/database).

Also, there is a rule factory implementation - [Rules Container](https://github.com/yiisoft/rbac-rules-container) (based
Also, there is a rule factory implementation - [Rules Container](https://github.com/yiisoft/rbac-rules-container) (based
on [Yii Factory](https://github.com/yiisoft/factory)).

All these can be replaced with custom implementations.
Expand Down Expand Up @@ -75,14 +75,14 @@ It requires the following dependencies:
- Assignments storage where user IDs are mapped to roles.
- Rule factory. Creates a rule instance by a given name.

While storages are required, rule factory is optional and, when omitted, `SimpleRuleFactory` will be used. For more
advanced usage, such as resolving rules by aliases and passing arguments in rules constructor, install
While storages are required, rule factory is optional and, when omitted, `SimpleRuleFactory` will be used. For more
advanced usage, such as resolving rules by aliases and passing arguments in rules constructor, install
[Rules Container](https://github.com/yiisoft/rbac-rules-container) additionally or write your own implementation.

A few tips for choosing storage backend:

- Roles and permissions could usually be considered "semi-static," as they only change when you update your application
code, so it may make sense to use PHP storage for it.
code, so it may make sense to use PHP storage for it.
- Assignments, on the other hand, could be considered "dynamic." They change more often: when creating a new user,
or when updating a user role from within your application. So it may make sense to use database storage for assignments.

Expand All @@ -94,7 +94,7 @@ commands or migrations. Hierarchy consists of permissions, roles, and rules:
- Permissions are granules of access such as "create a post" or "read a post."
- A role is what is assigned to the user. The Role is granted one or more permissions. Typical roles are "manager" or
"admin."
- Rule is a PHP class that has given some data answers a single question "given the data has the user the permission
- Rule is a PHP class that has given some data answers a single question "given the data has the user the permission
asked for."

To create a permission, use the following code:
Expand Down Expand Up @@ -213,7 +213,7 @@ $userId = 100;
$manager->assign('author', $userId);
```

It could be done in an admin panel, via console command, or it could be built into the application business logic
It could be done in an admin panel, via console command, or it could be built into the application business logic
itself.

### Check for permission
Expand All @@ -234,7 +234,7 @@ public function actionCreate(AccessCheckerInterface $accessChecker): ResponseInt
}
```

Sometimes you need to add guest-only permission, which is not assigned to any user ID. In this case, you can specify a
Sometimes you need to add guest-only permission, which is not assigned to any user ID. In this case, you can specify a
role which is assigned to guest user:

```php
Expand Down Expand Up @@ -278,7 +278,7 @@ You may also check out other [Yii Community Resources](https://www.yiiframework.

## License

The Yii Dependency Injection is free software. It is released under the terms of the BSD License.
The Yii Role-Based Access Control is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Software](https://www.yiiframework.com/).
Expand Down
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"homepage": "https://www.yiiframework.com/",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/rbac/issues",
"issues": "https://github.com/yiisoft/rbac/issues?state=open",
"source": "https://github.com/yiisoft/rbac",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "ircs://irc.libera.chat:6697/yii",
"chat": "https://t.me/yii3en",
"source": "https://github.com/yiisoft/rbac"
"chat": "https://t.me/yii3en"
},
"funding": [
{
Expand Down Expand Up @@ -57,7 +57,9 @@
"psr-4": {
"Yiisoft\\Rbac\\Tests\\": "tests"
},
"files": ["tests/bootstrap.php"]
"files": [
"tests/bootstrap.php"
]
},
"extra": {
"config-plugin-options": {
Expand Down

0 comments on commit e74beb2

Please sign in to comment.