切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
Karson
5 years ago
提交者
Gitee
5 years ago
提交
938671cf2bc4d201dd297f3a0bb5b64f3b9181f3
2 个父辈
014c29fc
a4f6a29c
!153 增加移除权限组节点后所有子权限组也一并移除相应权限
Merge pull request !153 from MrCai/pull2fastadmin
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
18 行增加
和
2 行删除
application/admin/controller/auth/Group.php
application/admin/controller/auth/Group.php
查看文件 @
938671c
...
...
@@ -5,6 +5,8 @@ namespace app\admin\controller\auth;
use
app\admin\model\AuthGroup
;
use
app\common\controller\Backend
;
use
fast\Tree
;
use
think\Db
;
use
think\Exception
;
/**
* 角色组
...
...
@@ -151,8 +153,22 @@ class Group extends Backend
$rules
=
in_array
(
'*'
,
$currentrules
)
?
$rules
:
array_intersect
(
$currentrules
,
$rules
);
$params
[
'rules'
]
=
implode
(
','
,
$rules
);
if
(
$params
)
{
$row
->
save
(
$params
);
$this
->
success
();
Db
::
startTrans
();
try
{
$row
->
save
(
$params
);
$children_auth_groups
=
model
(
"AuthGroup"
)
->
all
([
'id'
=>
[
'in'
,
implode
(
','
,(
Tree
::
instance
()
->
getChildrenIds
(
$row
->
id
)))]]);
$childparams
=
[];
foreach
(
$children_auth_groups
as
$key
=>
$children_auth_group
)
{
$childparams
[
$key
][
'id'
]
=
$children_auth_group
->
id
;
$childparams
[
$key
][
'rules'
]
=
implode
(
','
,
array_intersect
(
explode
(
','
,
$children_auth_group
->
rules
),
$rules
));
}
model
(
"AuthGroup"
)
->
saveAll
(
$childparams
);
Db
::
commit
();
$this
->
success
();
}
catch
(
Exception
$e
){
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
}
$this
->
error
();
return
;
...
...
请
注册
或
登录
后发表评论