vladshish/usershell

CakePHP应用程序中用于创建、完整和设置用户、组的额外工具。

安装: 94

依赖: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 0

开放问题: 0

类型:cakephp-plugin

0.0.6 2015-10-22 14:07 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:43:52 UTC


README

您可以使用此插件从配置设置文件创建组和用户。

加载插件

:: bootstrap.php ::
CakePlugin::load('UserShell');

### Configure

:: core-default.php :

```php
Configure::write('Groups', array(
		'modelName' => 'Group',
		'data' => array(
			'admin' => array(
				'id' => 1,
				'name' => 'Administrators',
				'status' => 0,
			),
			'member' => array(
				'id' => 2,
				'name' => 'Members',
				'status' => 0,
			)
		),
		'permissions' => array(
			'admin' => array(
				'id' => 1,
				'deny' => [],
				'allow' => [
					'controllers',
				],
			),
			'others' => array(
				'id !=' => [1],
				'deny' => array(
					'controllers/users/index',
					'controllers/users/edit',
					'controllers/users/delete',
					'controllers/users/create',
					'controllers/groups',
				),
				'allow' => array(
					'controllers',
				)
			),
		),
	));
	Configure::write('Users', array(
		'modelName' => 'User',
		'data' => array(
			'admin' => array(
				'id' => 1,
				'email' => 'example@example.com',
				'password' => 'example',
				'repead-password' => 'example',
				'status' => 1,
				'group_id' => 1,
			),
		),
		'conditions' => array(
			'status' => array(1, 2),
		),
	));

用法

如果组不存在,则会创建组

bin/cake UserShall.group init

添加缺失的组

bin/cake UserShall.group complete

仅设置组的权限

bin/cake UserShall.group set_permissions

如果用户不存在,则会创建用户

bin/cake UserShall.user create

添加缺失的用户

bin/cake UserShall.user complete