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

Update to 4.0.x #117

Merged
merged 31 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3354dc1
Move factories to the same folder as the class they are creating (#99)
visto9259 Jul 11, 2024
57d52ee
Added code-coverage-html script
visto9259 Aug 5, 2024
5c0c06f
Removed developer tools from view template map
visto9259 Aug 6, 2024
35c8e5e
Updated LmcRbac namespace ref
visto9259 Aug 6, 2024
4c21285
Refactor ModuleOptions.php to extend LmcRbac ModuleOptions
visto9259 Aug 6, 2024
5d13de5
Updated ref to LmcRbac namespace
visto9259 Aug 6, 2024
de6abf6
Updated to use Lmc\Rbac
visto9259 Aug 7, 2024
494c906
Added IdentityProvider options (moved from LmcRbac)
visto9259 Aug 8, 2024
3cad6e7
Updated docusaurus to 3.4.0
visto9259 Aug 9, 2024
3ebf651
Updated installation.md
visto9259 Aug 9, 2024
8d792ae
Updated Docusaurus core to 3.4.0
visto9259 Aug 9, 2024
db7d415
Merge branch 'LM-Commons:4.x' into 4.x
visto9259 Aug 9, 2024
6416f97
Updated dependencies for PHP 8.3
visto9259 Aug 13, 2024
0bb89a5
Prevent display of notices in tests
visto9259 Aug 13, 2024
bab5869
Added PHP 8.3 to matrix
visto9259 Aug 13, 2024
7153ff9
Removed packages no longer used
visto9259 Aug 15, 2024
0555ba7
Deleted old factories
visto9259 Aug 15, 2024
9627365
Deleted unused exception
visto9259 Aug 15, 2024
ebb001c
Delete role provider plugin (#101)
visto9259 Aug 15, 2024
e7597b6
Delete role provider plugin (#101)
visto9259 Aug 15, 2024
ef8b3a0
Undeprecate and restore Unauthorized Exceptions
visto9259 Aug 15, 2024
1a15443
Update UPGRADE.md
visto9259 Aug 15, 2024
dac5345
Merge remote-tracking branch 'origin/4.0.x' into 4.0.x
visto9259 Aug 16, 2024
ab40e6d
Cleaned up
visto9259 Aug 16, 2024
345144c
Removed assertion plug manager
visto9259 Aug 16, 2024
155dc60
Removed role providers
visto9259 Aug 16, 2024
be84e40
Added test for recursive iterators
visto9259 Aug 16, 2024
805f356
Update UPGRADE.md
visto9259 Aug 16, 2024
cadeced
Replaced referencs to Laminas\Permission
visto9259 Aug 16, 2024
c9f33b4
Replaced referencs to Laminas\Permission
visto9259 Aug 16, 2024
de6df4a
Merge remote-tracking branch 'origin/4.0.x' into 4.0.x
visto9259 Aug 16, 2024
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
6 changes: 0 additions & 6 deletions .cloveralls.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
build:
strategy:
matrix:
php_version: ['8.1', '8.2']
php_version: ['8.1', '8.2', '8.3']
deps: ['--prefer-lowest --prefer-dist', '']
include:
- code-coverage: 'yes'
php_version: '8.2'
php_version: '8.3'
deps: ''
runs-on: ubuntu-latest

Expand Down
58 changes: 0 additions & 58 deletions .travis.yml,deprecated

This file was deleted.

60 changes: 60 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# Upgrade guide

## From LmcRbacMvc v3 to LmcRbacMvc v4

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
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

### Namespace change

In an effort to In an effort to normalize LM-Commons components into a common Lmc namespace, the namespace will
be refactored to Lmc\Rbac\Mvc.

Please update your code to replace `LmcRbacMvc` by `Lmc\Rbac\Mvc`.

### Deprecations

The following components that were shared with LmcRbac are deprecated in LmcRbacMvc and should be replaced by their
LmcRbac equivalent:

- Lmc\Rbac\Mvc\Exception\ExceptionInterface
- Lmc\Rbac\Mvc\Exception\InvalidArgumentException
- Lmc\Rbac\Mvc\Exception\RoleNotFoundException
- Lmc\Rbac\Mvc\Exception\RuntimeException
- Lmc\Rbac\Mvc\Permission\PermissionInterface
- Lmc\Rbac\Mvc\Identity\IdentityInterface
- Lmc\Rbac\Mvc\Role\RoleProviderInterface

### Refactored and removed classes

#### Factories
- The factory classes were refactored from the `LmcRbacMvc\Factory` namespace to be colocated with
the service that the factory is creating. All the factories that were in `LmcRbacMvc\Factory` namespace have been
deleted.

#### Role providers
The former LmcRbacMvc v3 role providers are no longer available and replaced by LmcRbac equivalent. LmcRbac will throw
an exception if your config file still refers to them. In addition, the role provider plugin manager
was removed as it was not necessary.
- LmcRbacMvc\Role\RoleProviderPluginManager *no longer used*
- LmcRbacMvc\Role\InMemoryRoleProvider *replaced by a LmcRbac equivalent*
- LmcRbacMvc\Role\ObjectRepositoryRoleProvider *replaced by a LmcRbac equivalent*

#### Assertion
- LMcRbacMvc\Assertion\AssertionPluginManagerFactory *no longer used*
- LMcRbacMvc\Assertion\AssertionPluginManager *no longer used*

### Assertions refactoring
LmcRbacMvc is now using LmcRbac assertions and assertion plugin manager instead of its own.

Therefore all previous assertions in LmcRbacMvc v3 must now implement the `\Lmc\Rbac\Assertion\AssertionInterface`
otherwise LmcRbac will throw an exception.

`\Lmc\Rbac\Assertion\AssertionInterface` is a more generic interface for asserting permissions. An assertion under this
interface will be passed the permission, identity and context whereas in LmcRbacMvc v3, the assertion is
passed the AuthorizationService from which one had to get the identity. Having the permission as a parameter allows to
reuse the same assertion to handle multiple permissions.


## From zfc-rbac v2.x to LmcRbacMvc v3.0

- [BC] The namespace has been changed to `LmcRbacMvc`
Expand Down
31 changes: 13 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,22 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^8.1.0 | ^8.2.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"laminas/laminas-config": "^3.1",
"laminas/laminas-eventmanager": "^3.0",
"laminas/laminas-mvc": "^3.0",
"laminas/laminas-servicemanager": "^3.0",
"laminas/laminas-permissions-rbac": "^3.0",
"doctrine/persistence": "^2.1",
"lm-commons/lmc-rbac": "2.x-dev"
"lm-commons/lmc-rbac": "2.0.x-dev"
},
"require-dev": {
"laminas/laminas-authentication": "^2.2",
"laminas/laminas-developer-tools": "^2.1",
"laminas/laminas-log": "^2.2",
"laminas/laminas-http": "^2.2",
"laminas/laminas-i18n": "^2.7",
"laminas/laminas-serializer": "^2.2",
"laminas/laminas-view": "^2.12",
"phpunit/phpunit": "10.5.11",
"squizlabs/php_codesniffer": "^3.5.5",
"php-coveralls/php-coveralls": "^2.2",
"phpspec/prophecy-phpunit": "^2.0",
"doctrine/doctrine-orm-module": "^5.3",
"ext-mbstring": "*"
"phpspec/prophecy-phpunit": "^2.0"
},
"suggest": {
"laminas/laminas-developer-tools": "if you want to show information about the roles",
"doctrine/doctrine-module": "if you want to use Doctrine role provider"
"laminas/laminas-developer-tools": "if you want to show information about the roles"
},
"autoload": {
"psr-4": {
Expand All @@ -79,8 +68,14 @@
"scripts": {
"test": "phpunit",
"test-coverage": "phpunit --coverage-clover ./build/logs/clover.xml --exclude-group Functional",
"upload-coverage": "php-coveralls -v",
"cs-check": "phpcs -n --standard=PSR2 ./src/",
"cs-fix": "phpcbf ./src/"
}
"cs-fix": "phpcbf ./src/",
"test-coverage-html": "phpunit --coverage-html ./build/html"
},
"repositories": [
{
"type": "github",
"url": "https://github.com/visto9259/LmcRbac.git"
}
]
}
34 changes: 1 addition & 33 deletions config/lmc_rbac.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@

return [
'lmc_rbac' => [
/**
* Key that is used to fetch the identity provider
*
* Please note that when an identity is found, it MUST implements the LmcRbacMvc\Identity\IdentityProviderInterface
* interface, otherwise it will throw an exception.
*/
// 'identity_provider' => 'LmcRbacMvc\Identity\AuthenticationIdentityProvider',

/**
* Set the guest role
*
* This role is used by the authorization service when the authentication service returns no identity
*/
// 'guest_role' => 'guest',

/**
* Set the guards
Expand All @@ -62,31 +48,14 @@ return [
*/
// 'protection_policy' => \LmcRbacMvc\Guard\GuardInterface::POLICY_ALLOW,

/**
* Configuration for role provider
*
* It must be an array that contains configuration for the role provider. The provider config
* must follow the following format:
*
* 'LmcRbacMvc\Role\InMemoryRoleProvider' => [
* 'role1' => [
* 'children' => ['children1', 'children2'], // OPTIONAL
* 'permissions' => ['edit', 'read'] // OPTIONAL
* ]
* ]
*
* Supported options depend of the role provider, so please refer to the official documentation
*/
'role_provider' => [],

/**
* Configure the unauthorized strategy. It is used to render a template whenever a user is unauthorized
*/
'unauthorized_strategy' => [
/**
* Set the template name to render
*/
// 'template' => 'error/403'
// 'template' => 'lmcrbacmvc/error/403'
],

/**
Expand Down Expand Up @@ -127,6 +96,5 @@ return [
* plugin manager config format, and can be used to create your custom objects
*/
// 'guard_manager' => [],
// 'role_provider_manager' => []
]
];
119 changes: 0 additions & 119 deletions data/FlatRole.php.dist

This file was deleted.

Loading
Loading