Commit b81ea1f7 authored by zfc's avatar zfc

添加权限编辑1

parent eec36560
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
composer.lock composer.lock
*.log *.log
/nbproject/private/
\ No newline at end of file
...@@ -118,5 +118,52 @@ class Auth extends Basic ...@@ -118,5 +118,52 @@ class Auth extends Basic
} }
} }
/**
* 权限分配
* @param integer $group_id 组ID
* @return [type] [description]
* @date 2018-01-22
* @author zfc
*/
public function access_look($group_id=0){
$table= New AuthGroup();
$data['title']='权限分配';
echo $group_id;
exit;
if (IS_POST && $group_id=0) {
//添加or修改
$data['id'] = $group_id;
$menu_auth = input('post.menu_auth/a','');//获取所有授权菜单id
$data['rules'] = implode(',',$menu_auth);//拼接
$id = isset($data['id']) && $data['id']>0 ? $data['id']:false;
//开发过程中先关闭这个限制
//if($group_id==1){
//$this->error('不能修改超级管理员'.$title);
// }else{
if ( $table->editData($data,$id)) {
cache('admin_sidebar_menus_'.$this->currentUser['uid'],null);
return $this->response(200, '成功');
}else{
return $this->response(100, '失败');
}
//}
} else{
//查看
$role_auth_rule = $table->where(['id'=>intval($group_id)])->value('rules');
$data['menu_auth_rules']=explode(',',$role_auth_rule);//获取指定获取到的权限
}
$menu = $table->where(['pid'=>0,'status'=>1])->order('sort asc')->select();
foreach($menu as $k=>$v){
$menu[$k]['_child']=$this->authRuleModel->where(['pid'=>$v['id']])->order('sort asc')->select();
}
$data['all_auth_rules']=$menu;//所以规则
return $this->response(200,'可以查看',$data);
}
} }
\ No newline at end of file
This diff is collapsed.
...@@ -76,6 +76,7 @@ Route::group('index', [ ...@@ -76,6 +76,7 @@ Route::group('index', [
'getAuth' => ['index/auth/getAuth', ['method' => 'get']], //权限列表 'getAuth' => ['index/auth/getAuth', ['method' => 'get']], //权限列表
'access' => ['index/auth/access', ['method' => 'get']], //权限分配 'access' => ['index/auth/access', ['method' => 'get']], //权限分配
'addAuth' => ['index/auth/addAuth', ['method' => 'post']], //添加角色 'addAuth' => ['index/auth/addAuth', ['method' => 'post']], //添加角色
'access_look'=>['index/auth/access_look', ['method' => 'post']], //查看编辑角色权限
'roleedit' => ['index/auth/roleedit', ['method' => 'get']], //编辑角色 'roleedit' => ['index/auth/roleedit', ['method' => 'get']], //编辑角色
'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权 'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权
'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表 'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表
......
...@@ -27,7 +27,6 @@ define (['doT', 'text!temp/auth_template_tpl.html', 'css!style/home.css','pagina ...@@ -27,7 +27,6 @@ define (['doT', 'text!temp/auth_template_tpl.html', 'css!style/home.css','pagina
var temp = document.getElementById ('auth_list_tpl').innerHTML; var temp = document.getElementById ('auth_list_tpl').innerHTML;
var doTtmpl = doT.template (temp); var doTtmpl = doT.template (temp);
$ ("#auth_list").html (doTtmpl (data.data.list)); $ ("#auth_list").html (doTtmpl (data.data.list));
/*分页代码*/ /*分页代码*/
$ ("#pagediv").pagination ({ $ ("#pagediv").pagination ({
length: data.data.total, length: data.data.total,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment