Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Role, docs #125

Merged
merged 7 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 4 additions & 47 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
LmcRbacMvc v4 is a major upgrade with many breaking changes that prevent
straightforward upgrading.

LmcRbacMvc v3 and LmcRbac v1 shared a lot of code. LmcRbacMvc v2 is now based
LmcRbacMvc v3 and LmcRbac v1 shared a lot of code. LmcRbacMvc v4 is now based
on LmcRbac v2 which was augmented such that common code is now part of LmcRbac.
This has rendered many components of LmcRbacMvc unnecessary and they are deprecated
This has rendered many components of LmcRbacMvc unnecessary and they are deprecated.

In addition, LmcRbac v2 is now based on laminas-permissions-rbac's Role classes and interfaces.

### Namespace change

Expand Down Expand Up @@ -67,48 +69,3 @@ reuse the same assertion to handle multiple permissions.
- Requires PHP 7.2 or later
- Requires Laminas MVC components 3.x or later
- Uses PSR-4 autoload


## Previous zfc-rbac versions

### From v2.2 to v2.3

- No BC

### From v2.1 to v2.2

- [Potential BC] To simplify unit tests, we have introduced a new `AuthorizationServiceInterface` that the
`AuthorizationService` now implements. We didn't touch any interface (such as `AssertionInterface`) that rely explicitly
on typehinting the `AuthorizationService` to avoid big BC. However, we have updated the view helper and controller
plugins to use the interface instead. This can lead to a BC if you created subclasses of those plugins (which is
not a typical use case). If this is the case, just change `AuthorizationService` to `AuthorizationServiceInterface`.

### From v2.0 to v2.1

- [Potential BC] A potential BC have been introduced in v2.1 to respect interfaces of RBAC component more strictly.
However there is great chance that you have nothing to do. Now, ZfcRbac no longer cast permissions to string before
passing it to your "hasPermission" method in the Role entity. If you used to call `isGranted` using a string permission,
like this: `isGranted('myPermission')`, then you have nothing to do. However, if you are passing a `PermissionInterface`
object, you will now receive this object instead of a string. It's up to you to getting the name from your permission.

### From v1 to v2

Here are the major breaking changes from ZfcRbac 1 to ZfcRbac 2:

- [BC] Dependency to the ZF2 RBAC component has been replaced in favour of a ZF3 prototype which fixes a lot
of design issues.
- [BC] ZfcRbac no longer accepts multiple role providers. Therefore, the option `role_providers` has been renamed
to `role_provider`
- [BC] Permission providers are gone (hence, the options `permission_providers` as well as `permission_manager` should
be removed). Instead, roles now embed all the necessary information
- [BC] The `redirect_to_route` option for the `RedirectStrategy` is gone. Instead, we now have two options:
`redirect_to_route_connected` and `redirect_to_route_disconnected`. This solves an issue when people used to have
a guard on `login` for non-authenticated users only, which leaded to circular redirections.
- [BC] The default protection policy is now `POLICY_ALLOW`. `POLICY_DENY` was way too restrictive and annoying to
work with by default.
- [BC] `isGranted` method of the AuthorizationService no longer accepts an assertion as a second parameter. Instead,
the AuthorizationService now has an assertion map, that allows to map an assertion to a permission. This allows to
inject dependencies into assertions, as well as making the use of assertions much more transparent.
- [BC] Each assertions now receive the whole `AuthorizationService` instead of the current identity. This allows to
support use cases where an assertion needs to check another permission.
- [BC] Entity schema for hierarchical role have changed and no longer require to implement `RecursiveIterator`. Please have a look at the new schema in the `data` folder.
6 changes: 0 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@
"test-coverage-html": "phpunit --coverage-html ./build/html",
"static-analysis": "psalm --shepherd --stats"
},
"repositories": [
{
"type": "github",
"url": "https://github.com/visto9259/LmcRbac.git"
}
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
Expand Down
163 changes: 98 additions & 65 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading