更新
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller;
|
||||
use app\common\controller\Admin;
|
||||
namespace app\controller\admin;
|
||||
use app\controller\Admin;
|
||||
|
||||
/**
|
||||
* @title 用户组管理
|
||||
@@ -22,7 +22,7 @@ class Group extends Admin {
|
||||
public function _initialize() {
|
||||
parent::_initialize();
|
||||
$this->group = model('AuthGroup');
|
||||
$this->rule = model('AuthRule');
|
||||
$this->rule = model('AuthRule');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,8 +32,8 @@ class Group extends Admin {
|
||||
$map['module'] = $type;
|
||||
|
||||
$list = db('AuthGroup')->where($map)->order('id desc')->paginate(10, false, array(
|
||||
'query' => $this->request->param()
|
||||
));
|
||||
'query' => $this->request->param(),
|
||||
));
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
@@ -58,7 +58,7 @@ class Group extends Admin {
|
||||
}
|
||||
} else {
|
||||
$data = array(
|
||||
'info' => array('module' => $type, 'status' => 1),
|
||||
'info' => array('module' => $type, 'status' => 1),
|
||||
'keyList' => $this->group->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -84,7 +84,7 @@ class Group extends Admin {
|
||||
} else {
|
||||
$info = $this->group->where(array('id' => $id))->find();
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'info' => $info,
|
||||
'keyList' => $this->group->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -93,14 +93,13 @@ class Group extends Admin {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 编辑用户组单字段
|
||||
*/
|
||||
public function editable() {
|
||||
$pk = input('pk', '', 'trim,intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$value = input('value', '', 'trim');
|
||||
$pk = input('pk', '', 'trim,intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$value = input('value', '', 'trim');
|
||||
$result = $this->group->where(array('id' => $pk))->setField($name, $value);
|
||||
if ($result) {
|
||||
return $this->success("删除成功!");
|
||||
@@ -109,7 +108,6 @@ class Group extends Admin {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 删除用户组
|
||||
*/
|
||||
@@ -126,7 +124,6 @@ class Group extends Admin {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 权限节点
|
||||
*/
|
||||
@@ -134,8 +131,8 @@ class Group extends Admin {
|
||||
$map['module'] = $type;
|
||||
|
||||
$list = db('AuthRule')->where($map)->order('id desc')->paginate(15, false, array(
|
||||
'query' => $this->request->param()
|
||||
));
|
||||
'query' => $this->request->param(),
|
||||
));
|
||||
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
@@ -164,8 +161,8 @@ class Group extends Admin {
|
||||
return $this->error("非法操作!");
|
||||
}
|
||||
if ($this->request->isPost()) {
|
||||
$rule = $this->request->post('rule/a', array());
|
||||
$extend_rule = $this->request->post('extend_rule/a', array());
|
||||
$rule = $this->request->post('rule/a', array());
|
||||
$extend_rule = $this->request->post('extend_rule/a', array());
|
||||
$extend_result = $rule_result = false;
|
||||
//扩展权限
|
||||
$extend_data = array();
|
||||
@@ -179,7 +176,7 @@ class Group extends Admin {
|
||||
$extend_result = db('AuthExtend')->insertAll($extend_data);
|
||||
}
|
||||
if ($rule) {
|
||||
$rules = implode(',', $rule);
|
||||
$rules = implode(',', $rule);
|
||||
$rule_result = $this->group->where(array('id' => $id))->setField('rules', $rules);
|
||||
}
|
||||
|
||||
@@ -192,7 +189,7 @@ class Group extends Admin {
|
||||
$group = $this->group->where(array('id' => $id))->find();
|
||||
|
||||
$map['module'] = $group['module'];
|
||||
$row = db('AuthRule')->where($map)->order('id desc')->select();
|
||||
$row = db('AuthRule')->where($map)->order('id desc')->select();
|
||||
|
||||
$list = array();
|
||||
foreach ($row as $key => $value) {
|
||||
@@ -205,12 +202,12 @@ class Group extends Admin {
|
||||
->select();
|
||||
//扩展权限
|
||||
$extend_auth = db('AuthExtend')->where(array('group_id' => $id, 'type' => 2))->column('extend_id');
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'model' => $model,
|
||||
$data = array(
|
||||
'list' => $list,
|
||||
'model' => $model,
|
||||
'extend_auth' => $extend_auth,
|
||||
'auth_list' => explode(',', $group['rules']),
|
||||
'id' => $id,
|
||||
'auth_list' => explode(',', $group['rules']),
|
||||
'id' => $id,
|
||||
);
|
||||
$this->assign($data);
|
||||
$this->setMeta('授权');
|
||||
@@ -231,7 +228,7 @@ class Group extends Admin {
|
||||
}
|
||||
} else {
|
||||
$data = array(
|
||||
'info' => array('module' => $type, 'status' => 1),
|
||||
'info' => array('module' => $type, 'status' => 1),
|
||||
'keyList' => $this->rule->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
@@ -257,7 +254,7 @@ class Group extends Admin {
|
||||
}
|
||||
$info = $this->rule->find($id);
|
||||
$data = array(
|
||||
'info' => $info,
|
||||
'info' => $info,
|
||||
'keyList' => $this->rule->keyList,
|
||||
);
|
||||
$this->assign($data);
|
||||
|
||||
Reference in New Issue
Block a user