czim/laravel-cms-acl-module

此包已被废弃且不再维护。未建议替代包。
此包的最新版本(0.9.3)没有可用的许可证信息。

Laravel CMS: 权限控制模块

0.9.3 2017-03-20 14:37 UTC

This package is auto-updated.

Last update: 2021-05-09 21:25:41 UTC


README

适用于CMS的简单权限控制模块。

Laravel CMS Core一起使用。

安装

将模块类添加到您的cms-modules.php配置文件中

    'modules' => [
        // ...
        \Czim\CmsAclModule\AclModule::class,
    ],

将服务提供者添加到您的cms-modules.php配置文件中

    'providers' => [
        // ...
        Czim\CmsAclModule\Providers\CmsAclModuleServiceProvider::class,
        // ...
    ],

要发布配置

php artisan vendor:publish

配置

可用的权限是从核心模块定义的ACL存在中读取的。

任何自定义权限键都可以添加到cms-acl-module.php配置文件中的permissions

<?php
    'permissions' => [
        'example.custom.permission',
        'and.another',
    ],

在不进行进一步配置的情况下,这些权限将显示在权限列表的可选角色下,标题为“杂项”。

要分配自定义权限,甚至将模块提供的权限分配给(新)权限组,请使用groups配置数组。

例如

<?php
    'groups' => [
        [
            // The type must always be 'group'
            'type'        => 'group',
            // The label will be used for the multiselect optgroup
            'label'            => 'Some Label',
            // Translation key to use for a label for the optgroup. If this is set, the label value is ignored. 
            'label_translated' => 'some.translation.key',
            // Permissions should always be a list of available permission slug strings
            'permissions' => [
                'example.custom.permission',
                'models.app-models-post.show',
            ]
        ]
    ],

这将将两个权限分配给一个新组。

任何没有权限的组将自动隐藏,无论是模块定义的还是不是。

有关所有配置选项,请参阅配置文件

API文档

ACL模块API端点的文档:https://czim.github.io/laravel-cms-acl-module

贡献

请参阅CONTRIBUTING以获取详细信息。

致谢

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。