apaoww/yii2-admin-oci8

Yii2 Oracle Oci8 认证管理器

安装次数: 315

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 1

开放问题: 0

类型:yii2-extension

dev-master / 1.0.x-dev 2023-09-14 02:00 UTC

This package is not auto-updated.

Last update: 2024-09-25 06:03:37 UTC


README

文档

安装

使用 Composer 安装

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

运行以下命令:

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

for dev-master

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

或在您的 composer.json 文件的 require 部分添加:

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

从存档安装

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

用法

扩展安装完成后,只需按以下方式修改您的应用程序配置:

return [
	'modules' => [
		'admin' => [
			'class' => 'apaoww\AdminOci8\Module',
            ...
		]
		...
	],
	...
	'components' => [
		....
		'authManager' => [
			'class' => 'yii\rbac\PhpManager', // or use 'yii\rbac\DbManager'
		]
	],
    'as access' => [
        'class' => 'apaoww\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' => 'apaoww\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
            ],
        ],
        ...
    ],

截图