修改权限

This commit is contained in:
wuyanwen 2019-12-28 21:21:05 +08:00
parent 1798cbcd0c
commit 06726f8fc0
4 changed files with 18 additions and 18 deletions

View File

@ -11,6 +11,7 @@ class Permissions extends CatchModel
'id', // 'id', //
'permission_name', // 菜单名称 'permission_name', // 菜单名称
'parent_id', // 父级ID 'parent_id', // 父级ID
'icon',
'module', // 模块 'module', // 模块
'route', // 路由 'route', // 路由
'method', // 请求方法 'method', // 请求方法

View File

@ -81,11 +81,9 @@ class Auth
$roles = $user->getRoles(); $roles = $user->getRoles();
foreach ($roles as &$role) { $user->permissions = Permissions::whereIn('id', $user->getPermissionsBy())
$role['permissions'] = Roles::where('id', $role['id'])->find()->getPermissions([ ->field(['permission_name as title', 'route', 'icon'])
'type' => Permissions::MENU_TYPE ->select();
], ['permission_name', 'route']);
}
$user->roles = $roles; $user->roles = $roles;

View File

@ -5,3 +5,4 @@ $router->resource('users', '\catchAdmin\user\controller\User');
$router->put('users/switch/status/<id>', '\catchAdmin\user\controller\User@switchStatus'); $router->put('users/switch/status/<id>', '\catchAdmin\user\controller\User@switchStatus');
$router->put('users/recover/<id>', '\catchAdmin\user\controller\User@recover'); $router->put('users/recover/<id>', '\catchAdmin\user\controller\User@recover');
$router->get('users/get/roles', '\catchAdmin\user\controller\User@getRoles'); $router->get('users/get/roles', '\catchAdmin\user\controller\User@getRoles');
$router->get('user/info', '\catchAdmin\user\controller\User@info');

22
composer.lock generated
View File

@ -1,7 +1,7 @@
{ {
"_readme": [ "_readme": [
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "867a29731eb9f56d75d75bd32e8a9f37", "content-hash": "867a29731eb9f56d75d75bd32e8a9f37",
@ -69,16 +69,16 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.0.57", "version": "1.0.61",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a" "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/4fb13c01784a6c9f165a351e996871488ca2d8c9",
"reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a", "reference": "4fb13c01784a6c9f165a351e996871488ca2d8c9",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -155,7 +155,7 @@
"sftp", "sftp",
"storage" "storage"
], ],
"time": "2019-10-16T21:01:05+00:00" "time": "2019-12-08T21:46:50+00:00"
}, },
{ {
"name": "league/flysystem-cached-adapter", "name": "league/flysystem-cached-adapter",
@ -1039,16 +1039,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v4.4.1", "version": "v4.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "0a89a1dbbedd9fb2cfb2336556dec8305273c19a" "reference": "be330f919bdb395d1e0c3f2bfb8948512d6bdd99"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0a89a1dbbedd9fb2cfb2336556dec8305273c19a", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/be330f919bdb395d1e0c3f2bfb8948512d6bdd99",
"reference": "0a89a1dbbedd9fb2cfb2336556dec8305273c19a", "reference": "be330f919bdb395d1e0c3f2bfb8948512d6bdd99",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -1117,7 +1117,7 @@
"debug", "debug",
"dump" "dump"
], ],
"time": "2019-11-28T13:33:56+00:00" "time": "2019-12-18T13:41:29+00:00"
}, },
{ {
"name": "topthink/think-trace", "name": "topthink/think-trace",