|
|
|
@ -27,7 +27,7 @@ class AuthManagerController extends AdminController{
|
|
|
|
|
//需要新增的节点必然位于$nodes
|
|
|
|
|
$nodes = $this->returnNodes(false);
|
|
|
|
|
|
|
|
|
|
$AuthRule = M('AuthRule');
|
|
|
|
|
$AuthRule = SM('AuthRule');
|
|
|
|
|
$map = array('module'=>'admin','type'=>array('in','1,2'));//status全部取出,以进行更新
|
|
|
|
|
//需要更新和删除的节点必然位于$rules
|
|
|
|
|
$rules = $AuthRule->where($map)->order('name')->select();
|
|
|
|
@ -128,7 +128,7 @@ class AuthManagerController extends AdminController{
|
|
|
|
|
* @author 朱亚杰 <zhuyajie@topthink.net>
|
|
|
|
|
*/
|
|
|
|
|
public function editGroup(){
|
|
|
|
|
$auth_group = M('AuthGroup')->where( array('module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) )
|
|
|
|
|
$auth_group = SM('AuthGroup')->where( array('module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) )
|
|
|
|
|
->find( (int)$_GET['id'] );
|
|
|
|
|
$this->assign('auth_group',$auth_group);
|
|
|
|
|
$this->meta_title = '编辑用户组';
|
|
|
|
@ -151,9 +151,9 @@ class AuthManagerController extends AdminController{
|
|
|
|
|
->getfield('id,id,title,rules');
|
|
|
|
|
$node_list = $this->returnNodes();
|
|
|
|
|
$map = array('module'=>'admin','type'=>AuthRuleModel::RULE_MAIN,'status'=>1);
|
|
|
|
|
$main_rules = M('AuthRule')->where($map)->getField('name,id');
|
|
|
|
|
$main_rules = SM('AuthRule')->where($map)->getField('name,id');
|
|
|
|
|
$map = array('module'=>'admin','type'=>AuthRuleModel::RULE_URL,'status'=>1);
|
|
|
|
|
$child_rules = M('AuthRule')->where($map)->getField('name,id');
|
|
|
|
|
$child_rules = SM('AuthRule')->where($map)->getField('name,id');
|
|
|
|
|
|
|
|
|
|
$this->assign('main_rules', $main_rules);
|
|
|
|
|
$this->assign('auth_rules', $child_rules);
|
|
|
|
@ -205,40 +205,30 @@ class AuthManagerController extends AdminController{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(isset($_POST['rules'])){
|
|
|
|
|
$isrules = true;
|
|
|
|
|
if(!empty($ruleiddata)){
|
|
|
|
|
$_POST['rules'] = array_merge($_POST['rules'],$ruleiddata);
|
|
|
|
|
}
|
|
|
|
|
sort($_POST['rules']);
|
|
|
|
|
$_POST['rules'] = implode( ',' , array_unique($_POST['rules']));
|
|
|
|
|
}else{
|
|
|
|
|
$isrules = false;
|
|
|
|
|
$_POST['rules'] = '';
|
|
|
|
|
}
|
|
|
|
|
$_POST['module'] = 'admin';
|
|
|
|
|
$_POST['type'] = AuthGroupModel::TYPE_ADMIN;
|
|
|
|
|
$AuthGroup = D('AuthGroup');
|
|
|
|
|
$AuthGroup = SM('AuthGroup');
|
|
|
|
|
$data = $AuthGroup->create();
|
|
|
|
|
if ( $data ) {
|
|
|
|
|
if ( empty($data['id']) ) {
|
|
|
|
|
if(!IS_SUBSITE){
|
|
|
|
|
\Think\Log::actionLog('AuthManager/createGroup','authGroup',1);
|
|
|
|
|
}
|
|
|
|
|
$r = $AuthGroup->syncAdd($data);
|
|
|
|
|
$r = $AuthGroup->add($data);
|
|
|
|
|
addOperationLog(array(
|
|
|
|
|
"op_type"=>0,
|
|
|
|
|
"key"=> $_POST['title'],
|
|
|
|
|
"url"=>U("AuthManager/index")
|
|
|
|
|
));
|
|
|
|
|
}else{
|
|
|
|
|
if(!IS_SUBSITE){
|
|
|
|
|
\Think\Log::actionLog('AuthManager/editGroup','authGroup',1);
|
|
|
|
|
}
|
|
|
|
|
if($isrules){
|
|
|
|
|
$r = SM("auth_group","sys_")->save($data);
|
|
|
|
|
}else{
|
|
|
|
|
$r = $AuthGroup->where("id={$data['id']}")->syncSave($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//操作日志,不传title表示是访问授权
|
|
|
|
|
$oparr = array(
|
|
|
|
|