예제 #1
0
 private function perm_code()
 {
     $uid = Lua::post('uid');
     $udb = Lua::get_one("select username,perm from lua_admin where uid='{$uid}'");
     if (empty($udb)) {
         Lua::admin_msg('提示信息', '此用户不存在');
     }
     if ($udb['perm'] == SUPER_MAN) {
         Lua::admin_msg('提示信息', '此用户为超级管理员');
     }
     $perms = Lua::perms();
     $__member = Lua::post('__member');
     $__category = Lua::post('__category');
     $__content = Lua::post('__content');
     $__file = Lua::post('__file');
     $__piece = Lua::post('__piece');
     if (empty($__member)) {
         Lua::admin_msg('提示信息', '请选择会员管理');
     }
     if (empty($__category)) {
         Lua::admin_msg('提示信息', '请选择栏目管理');
     }
     if (empty($__content)) {
         Lua::admin_msg('提示信息', '请选择内容管理');
     }
     if (empty($__file)) {
         Lua::admin_msg('提示信息', '请选择图片管理');
     }
     if (empty($__piece)) {
         Lua::admin_msg('提示信息', '请选择碎片管理');
     }
     $__code['__home'] = array("index", "info");
     $__code['__login'] = array("index", "logout", "E404", "E401");
     if (in_array('*', $__member)) {
         $__code['__member'] = '*';
     } else {
         $__code['__member'] = $__member;
     }
     if (in_array('*', $__category)) {
         $__code['__category'] = '*';
     } else {
         $__code['__category'] = $__category;
     }
     if (in_array('*', $__content)) {
         $__code['__content'] = '*';
     } else {
         $__code['__content'] = $__content;
     }
     if (in_array('*', $__file)) {
         $__code['__file'] = '*';
     } else {
         $__code['__file'] = $__file;
     }
     if (in_array('*', $__piece)) {
         $__code['__piece'] = '*';
     } else {
         $__code['__piece'] = $__piece;
     }
     $__code['__extend'] = '*';
     $aclfile = PROJECT_ROOT . 'config/acl.php';
     include $aclfile;
     $acl[$udb['perm']]['allow'] = $__code;
     $data = $this->_acl($acl);
     file_put_contents($aclfile, $data);
     Lua::write_log($this->user, 'ACL权限设置', "group=" . $udb['perm'] . "<br />title=更新", SYSNAME);
     Lua::admin_msg('信息提示', '操作成功', './admin.htm');
 }