ekalokman/yii2-admin-oci8-by-kcd

Yii2 Oracle Oci8 授权管理器

安装: 6

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

类型:yii2-extension

dev-main 2023-08-30 02:40 UTC

This package is not auto-updated.

Last update: 2024-09-26 06:20:22 UTC


README

文档

安装

使用 Composer 安装

安装此扩展的首选方式是通过Composer

运行以下命令:

php composer.phar require ekalokman/yii2-admin-oci8 "dev-master"

for dev-master

php composer.phar require ekalokman/yii2-admin-oci8 "dev-master"

或者将以下内容添加到你的 composer.json 文件的 require 部分:

"ekalokman/yii2-admin-oci8": "dev-master"

从存档安装

return [
    ...
    'aliases' => [
        '@ekalokman/AdminOci8' => 'path/to/your/extracted',
        ...
    ]
];

使用方法

扩展安装完成后,只需修改你的应用程序配置如下:

return [
	'modules' => [
		'admin' => [
			'class' => 'ekalokman\AdminOci8\Module',
            ...
		]
		...
	],
	...
	'components' => [
		....
		'authManager' => [
			'class' => 'yii\rbac\PhpManager', // or use 'yii\rbac\DbManager'
		]
	],
    'as access' => [
        'class' => 'ekalokman\AdminOci8\components\AccessControl',
		'allowActions' => [
			'admin/*', // add or remove allowed actions to this list
		]
    ],
];

有关更多详细信息,请参阅 Yii RBAC。然后,你可以通过以下 URL 访问授权管理器

https:///path/to/index.php?r=admin
https:///path/to/index.php?r=admin/route
https:///path/to/index.php?r=admin/permission
https:///path/to/index.php?r=admin/menu
https:///path/to/index.php?r=admin/role
https:///path/to/index.php?r=admin/assignment

要使用菜单管理器(可选)。在此执行 yii 迁移

yii migrate --migrationPath=@mdm/admin/migrations

如果你使用数据库(类 'yii\rbac\DbManager')来保存 rbac 数据。在此执行 yii 迁移

yii migrate --migrationPath=@yii/rbac/migrations

自定义控制器

某些控制器属性可能需要更改。要实现这一点,请通过 controllerMap 属性进行更改。

	'modules' => [
		'admin' => [
			...,
            'controllerMap' => [
                 'assignment' => [
                    'class' => 'ekalokman\AdminOci8\controllers\AssignmentController',
                    'userClassName' => 'path\to\models\User',
                    'idField' => 'user_id', // id field of model User
                ]
            ],
            ...
		]
		...
	],

自定义布局

默认情况下,module 使用应用程序布局作为模板。要更改它,你必须设置 layout 属性。此扩展包含三个可用的布局,分别是 'left-menu', 'right-menu' 和 'top-menu'。

	'modules' => [
		'admin' => [
			...,
            'layout' => 'left-menu', // default null. other avaliable value 'right-menu' and 'top-menu'
        ],
        ...
    ],

如果你使用其中之一,你还可以自定义菜单。你可以更改菜单标签或禁用它。

	'modules' => [
		'admin' => [
			...,
            'layout' => 'left-menu', // default null. other avaliable value 'right-menu' and 'top-menu'
            'menus' => [
                'assignment' => [
                    'label' => 'Grand Access' // change label
                ],
                'route' => null, // disable menu
            ],
        ],
        ...
    ],

截图