优化权限

master
chenzhi 4 years ago
parent 5ea5bb2eaa
commit 8f7405bb17

@ -470,13 +470,18 @@ class AdminController extends Controller {
* @return array|false * @return array|false
* 返回数据集 * 返回数据集
*/ */
protected function lists ($model,$where=array(),$order='',$field=true){ protected function lists ($model,$where=array(),$order='',$field=true,$check_subsite=false){
$options = array(); $options = array();
$REQUEST = (array)I('request.'); $REQUEST = (array)I('request.');
if(is_string($model)){ if(is_string($model)){
if($check_subsite){
$model = SM($model);
}else{
$model = M($model); $model = M($model);
} }
}
$OPT = new \ReflectionProperty($model,'options'); $OPT = new \ReflectionProperty($model,'options');
$OPT->setAccessible(true); $OPT->setAccessible(true);

@ -90,7 +90,7 @@ class AuthManagerController extends AdminController{
* @author 朱亚杰 <zhuyajie@topthink.net> * @author 朱亚杰 <zhuyajie@topthink.net>
*/ */
public function index(){ public function index(){
$list = $this->lists('AuthGroup',array('module'=>'admin'),'id asc'); $list = $this->lists('AuthGroup',array('module'=>'admin'),'id asc',true,true);
$list = int_to_string($list); $list = int_to_string($list);
$this->assign( '_list', $list ); $this->assign( '_list', $list );
$this->assign( '_use_tip', true ); $this->assign( '_use_tip', true );

@ -502,6 +502,7 @@ class UserController extends AdminController
$this->assign("authid", $au["group_id"]); $this->assign("authid", $au["group_id"]);
$this->assign("houtai", $au["houtai"]); $this->assign("houtai", $au["houtai"]);
$list = D('AuthGroup')->where(array('status' => 1))->select(); $list = D('AuthGroup')->where(array('status' => 1))->select();
dd(D('AuthGroup'));
$username = $_POST['username']; $username = $_POST['username'];
$password = $_POST['password']; $password = $_POST['password'];
$this->assign('lists', $list); $this->assign('lists', $list);

@ -15,7 +15,7 @@ use Think\Model;
* Class AuthGroupModel * Class AuthGroupModel
* @author 朱亚杰 <zhuyajie@topthink.net> * @author 朱亚杰 <zhuyajie@topthink.net>
*/ */
class AuthGroupModel extends SubsiteModel { class AuthGroupModel extends Model {
const TYPE_ADMIN = 1; // 管理员用户组类型标识 const TYPE_ADMIN = 1; // 管理员用户组类型标识
const MEMBER = 'member'; const MEMBER = 'member';
const UCENTER_MEMBER = 'ucenter_member'; const UCENTER_MEMBER = 'ucenter_member';

@ -634,7 +634,7 @@ function M($name='', $tablePrefix='',$connection='') {
* @param boolean $is_subsiteTable 是否强制使用子站 * @param boolean $is_subsiteTable 是否强制使用子站
* @return Think\Model * @return Think\Model
*/ */
function SM($name='', $tablePrefix='tab_',$is_subsiteTable=false) function SM($name='', $tablePrefix='sys_',$is_subsiteTable=false)
{ {
if(empty($name)){ if(empty($name)){
if(IS_SUBSITE){ if(IS_SUBSITE){

Loading…
Cancel
Save