diff --git a/application/admin/controller/auth/Group.php b/application/admin/controller/auth/Group.php index 8fa5d1c..0e82c8d 100644 --- a/application/admin/controller/auth/Group.php +++ b/application/admin/controller/auth/Group.php @@ -95,7 +95,7 @@ class Group extends Backend $params = $this->request->post("row/a", [], 'strip_tags'); $params['rules'] = explode(',', $params['rules']); if (!in_array($params['pid'], $this->childrenGroupIds)) { - $this->error(__('The parent group can not be its own child')); + $this->error(__('The parent group exceeds permission limit')); } $parentmodel = model("AuthGroup")->get($params['pid']); if (!$parentmodel) { @@ -125,6 +125,9 @@ class Group extends Backend */ public function edit($ids = null) { + if (!in_array($ids, $this->childrenGroupIds)) { + $this->error(__('You have no permission')); + } $row = $this->model->get(['id' => $ids]); if (!$row) { $this->error(__('No Results were found')); @@ -132,9 +135,13 @@ class Group extends Backend if ($this->request->isPost()) { $this->token(); $params = $this->request->post("row/a", [], 'strip_tags'); - // 父节点不能是它自身的子节点 + //父节点不能是非权限内节点 if (!in_array($params['pid'], $this->childrenGroupIds)) { - $this->error(__('The parent group can not be its own child')); + $this->error(__('The parent group exceeds permission limit')); + } + // 父节点不能是它自身的子节点或自己本身 + if (in_array($params['pid'], Tree::instance()->getChildrenIds($row->id,true))){ + $this->error(__('The parent group can not be its own child or itself')); } $params['rules'] = explode(',', $params['rules']); diff --git a/application/admin/lang/zh-cn/auth/group.php b/application/admin/lang/zh-cn/auth/group.php index 4c25c85..3a63f58 100644 --- a/application/admin/lang/zh-cn/auth/group.php +++ b/application/admin/lang/zh-cn/auth/group.php @@ -7,4 +7,6 @@ return [ 'Can not change the parent to child' => '父组别不能是它的子组别', 'Can not change the parent to self' => '父组别不能是它的子组别', 'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组', + 'The parent group exceeds permission limit' => '父组别超出权限范围', + 'The parent group can not be its own child or itself' => '父组别不能是它的子组别及本身', ];