This repository has been archived by the owner on Jul 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #380 from svycka/plugin-managers-refactor
Plugin managers refactor and more improvements
- Loading branch information
Showing
27 changed files
with
320 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,29 +19,11 @@ | |
|
||
declare(strict_types=1); | ||
|
||
namespace ZfcRbac\Role; | ||
namespace ZfcRbac\Assertion; | ||
|
||
use Zend\ServiceManager\AbstractPluginManager; | ||
use Zend\ServiceManager\Factory\InvokableFactory; | ||
use ZfcRbac\Container\ObjectRepositoryRoleProviderFactory; | ||
use Psr\Container\ContainerInterface; | ||
|
||
/** | ||
* Plugin manager to create role providers | ||
* | ||
* @method RoleProviderInterface get($name) | ||
* | ||
* @author Michaël Gallego <[email protected]> | ||
* @license MIT | ||
*/ | ||
final class RoleProviderPluginManager extends AbstractPluginManager | ||
interface AssertionContainerInterface extends ContainerInterface | ||
{ | ||
protected $instanceOf = RoleProviderInterface::class; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $factories = [ | ||
InMemoryRoleProvider::class => InvokableFactory::class, | ||
ObjectRepositoryRoleProvider::class => ObjectRepositoryRoleProviderFactory::class, | ||
]; | ||
public function get($name): AssertionInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,20 +22,23 @@ | |
namespace ZfcRbac\Container; | ||
|
||
use Psr\Container\ContainerInterface; | ||
use ZfcRbac\Role\RoleProviderPluginManager; | ||
use ZfcRbac\Options\ModuleOptions; | ||
use ZfcRbac\Role\InMemoryRoleProvider; | ||
|
||
/** | ||
* Factory to create a role provider plugin manager | ||
* Factory used to create an in memory role provider | ||
* | ||
* @author Michaël Gallego <[email protected]> | ||
* @author Vytautas Stankus | ||
* @licence MIT | ||
*/ | ||
final class RoleProviderPluginManagerFactory | ||
final class InMemoryRoleProviderFactory | ||
{ | ||
public function __invoke(ContainerInterface $container): RoleProviderPluginManager | ||
public function __invoke(ContainerInterface $container): InMemoryRoleProvider | ||
{ | ||
$config = $container->get('config')['zfc_rbac']['role_provider_manager']; | ||
$moduleOptions = $container->get(ModuleOptions::class); | ||
|
||
return new RoleProviderPluginManager($container, $config); | ||
return new InMemoryRoleProvider( | ||
$moduleOptions->getRoleProvider()[InMemoryRoleProvider::class] ?? [] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.