contextualcode/ezplatform-role-inheritance-bundle
Composer 安装命令:
composer require contextualcode/ezplatform-role-inheritance-bundle
包简介
eZ Platform bundle which provides user role inheritance.
README 文档
README
This is an eZ Platform bundle which provides user role inheritance.
This is different from the built-in User Group inheritance because it allows for fine-grained, easy management of user roles that doesn't depend on groups.
(This is an eZ Platform port of permissions-inheritance-bundle.)
Installation
- Run
composer require:
$ composer require contextualcode/ezplatform-role-inheritance-bundle
- Enable this bundle in
app/AppKernel.phpfile by adding next line inregisterBundlesmethod:
public function registerBundles()
{
$bundles = array(
...
new ContextualCode\EzPlatformRoleInheritanceBundle\ContextualCodeEzPlatformRoleInheritanceBundle(),
);
- Add the routes to your
app/config/routing.yml:contextual_code_ez_platform_role_inheritance: resource: "@ContextualCodeEzPlatformRoleInheritanceBundle/Resources/config/routing.yml" prefix: / - Create new custom database tables:
$ cat vendor/contextualcode/ezplatform-role-inheritance-bundle/src/ContextualCode/EzPlatformRoleInheritanceBundle/SQL/MySQL/schema.sql | mysql -u <username -p<password> <database_name>
Note: If you are upgrading from an eZ 5.x install that was using contextualcode/permissions-inheritance-bundle, please instead run the upgrade SQL to retain your old role inheritances:
$ cat vendor/contextualcode/ezplatform-role-inheritance-bundle/src/ContextualCode/EzPlatformRoleInheritanceBundle/SQL/MySQL/upgrade.sql | mysql -u <username -p<password> <database_name>
- Done.
Usage
- Just open the role view page in the admin UI. There will be new functionality to add parent/child roles, in the "Role Inheritances" tab.
- Additional code needs to be executed to assign inherited roles to the user: you must call the function
handleUserChildRoles($userId)of RoleInheritanceService. You can use a custom login handler/event listener or any other way to call that code. For example, you can createAppBundle\Security\User\Provider.phpthat extendseZ\Publish\Core\MVC\Symfony\Security\User\Provider. Add the RoleInheritanceService to the constructor, and override therefreshUserfunction to add these lines to load the inherited roles:$userId = $user->getAPIUser()->contentInfo->id; $this->roleInheritanceService->handleUserChildRoles($userId);Then you must set
security.providers.ezpublish.idto use the id of this new Provider. Now users will inherit roles set in the admin UI.
统计信息
- 总下载量: 159
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-only
- 更新时间: 2019-04-14