切换导航条
此项目
正在载入...
登录
何书鹏
/
recruit
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
cxb
5 years ago
提交
a4f6a29c09dfc04a7e05c6f00bed134b7c1c9542
1 个父辈
f8714972
角色组编辑,当取消某个角色组权限节点时,把该权限组的所有子权限组节点相应权限节点也取消,避免取消父节点节点权限后子节点仍可访问。
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
18 行增加
和
2 行删除
application/admin/controller/auth/Group.php
application/admin/controller/auth/Group.php
查看文件 @
a4f6a29
...
...
@@ -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
;
...
...
请
注册
或
登录
后发表评论