123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597 |
- <?php
- $option = array
- (
- 1 => '可用',
- 2 => '不可用',
- );
- $top = function()
- {
- $data = Dever::load('manage/top.all');
- $data['state'] = 1;
- return $data;
- };
- $oper = array
- (
- 1 => '列表',
- 2 => '搜索',
- 3 => '编辑',
- 4 => '新增',
- 5 => '删除',
-
- );
- $self = array
- (
- 1 => '是',
- 2 => '否',
- );
- $cur = Dever::load('manage/auth.data');
- $desc = '';
- if($cur && $cur['role'] > 1)
- {
- $desc = $cur['username'] . ',你好,你可以在此管理你的下属角色';
-
- Dever::$global['model']['manage/role-all'] = Dever::$global['model']['manage/role-list'] = array
- (
- 'option_role_id' => $cur['role'],
- );
- $temp = explode(',', $cur['oper']);
- foreach($oper as $k => $v)
- {
- if(!in_array($k, $temp))
- {
- unset($oper[$k]);
- }
- }
- }
- $auth = function() use($cur)
- {
- if($cur['role'] > 1)
- {
- $auth = Dever::load('manage/auth.get', false);
- }
- else
- {
- $auth = Dever::load('manage/auth.get', true);
- }
- return $auth;
- };
- $role = function() use($cur)
- {
- $param = $array = array();
- if($cur['role'] > 1)
- {
- $param['option_id'] = $cur['role'];
- }
- else
- {
- $array = array(-1 => array('name' => '无'));
- }
-
- $data = Dever::load('manage/role-main', $param);
- if($data)
- {
- $array += $data;
- }
- return $array;
- };
- $auth_data = function()
- {
- $auth_data = Dever::load('manage/auth.getByData');
- return $auth_data;
- };
- $config = array
- (
-
- 'name' => 'role',
-
- 'lang' => '角色管理',
- 'desc' => $desc,
- 'order' => 90,
-
- 'type' => 'innodb',
-
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => '角色ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'search' => 'order',
- 'list' => true,
- ),
-
- 'name' => array
- (
- 'type' => 'varchar-24',
- 'name' => '角色名',
- 'default' => '',
- 'desc' => '请输入角色名',
- 'match' => 'is_string',
- 'update' => 'text',
- 'search' => 'fulltext',
- 'list_name' => '角色名',
- 'list' => true,
- 'edit' => true,
- 'tab' => 0,
- ),
-
- 'role_id' => array
- (
- 'type' => 'int-11',
- 'name' => '上级角色',
- 'default' => '-1',
- 'desc' => '请选择上级角色',
- 'match' => 'is_numeric',
- 'update' => 'select',
- 'search' => 'order,select',
- 'list' => '{role_id}',
- 'option' => $role,
- 'edit' => true,
- 'tab' => 1,
- ),
- 'self' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '是否只能管理自己发布的内容-请在需要此项权限的表中增加[数据查询时影响的字段]',
- 'default' => '2',
- 'desc' => '请选择是否只能管理自己发布的内容',
- 'match' => 'option',
- 'update' => 'radio',
- 'option' => $self,
- 'auth' => '"{my_role_id}"==1',
- 'tab' => 1,
- ),
- 'col_select' => array
- (
- 'type' => 'varchar-30',
- 'name' => '数据查询时影响的字段-该项影响数据查询,如果在表中增加该字段,则后台在查询数据时自动查询当前管理员的id下的数据,多个用逗号隔开,与[是否只能管理自己发布的内容]相关',
- 'default' => 'admin_founder',
- 'desc' => '数据更新时影响的字段',
- 'match' => 'option',
- 'update' => 'text',
- 'auth' => '"{my_role_id}"==1',
- 'tab' => 1,
- ),
- 'col_insert' => array
- (
- 'type' => 'varchar-30',
- 'name' => '数据插入时影响的字段-该项影响数据插入,如果在表中增加该字段,则后台操作时自动为该字段赋值为当前管理员的id,多个用逗号隔开',
- 'default' => 'admin_founder',
- 'desc' => '数据插入时影响的字段',
- 'match' => 'option',
- 'update' => 'text',
- 'auth' => '"{my_role_id}"==1',
- 'tab' => 1,
- ),
- 'col_update' => array
- (
- 'type' => 'varchar-30',
- 'name' => '数据更新时影响的字段-该项影响数据更新,如果在表中增加该字段,则后台操作时自动为该字段赋值为当前管理员的id,多个用逗号隔开',
- 'default' => 'admin_editor',
- 'desc' => '数据更新时影响的字段',
- 'match' => 'option',
- 'update' => 'text',
- 'auth' => '"{my_role_id}"==1',
- 'tab' => 1,
- ),
-
-
-
- 'oper' => array
- (
- 'type' => 'varchar-24',
- 'name' => '通用操作权限',
- 'default' => array(1,2,3),
- 'desc' => '请选择操作权限',
- 'match' => 'is_string',
- 'update' => 'checkbox',
- 'option' => $oper,
- ),
-
- 'auth' => array
- (
- 'type' => 'text-255',
- 'name' => '功能权限',
- 'default' => '',
- 'desc' => '请选择功能权限',
- 'match' => 'option',
- 'update' => 'checkbox',
-
-
-
- 'option' => $auth,
- ),
- 'top' => array
- (
- 'type' => 'text-255',
- 'name' => '数据权限',
- 'default' => '',
- 'desc' => '请选择数据权限',
- 'match' => 'option',
-
- 'option' => $top,
- ),
- 'auth_data' => array
- (
- 'type' => 'text-255',
- 'name' => '数据权限',
- 'default' => '',
- 'desc' => '数据权限',
- 'match' => 'option',
-
-
-
-
- 'option' => $auth_data,
- ),
- ),
-
-
-
-
- 'default' => array
- (
- 'col' => 'name,oper,auth,role_id,col_update,col_insert,col_select,state,cdate',
- 'value' => array
- (
- '"系统管理员","1,2,3,4,5","all",-1,"admin","admin","admin",1,' . time(),
- '"普通管理员","1,2,3,4,5","",-1,"admin","admin","admin",1,' . time(),
- ),
- ),
-
-
-
-
-
-
-
- 'manage' => array
- (
-
-
-
-
-
-
-
-
-
-
-
-
- 'preview' => true,
-
-
-
-
- 'excel' => true,
-
- 'mul' => true,
-
-
-
-
-
- 'list_button' => array('update' => '编辑'),
-
-
- 'button' => array
- (
-
- ),
- 'tab' => array('基本权限设置', '高级设置'),
- ),
-
- 'request' => array
- (
- 'getData' => array
- (
-
- 'option' => array
- (
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('id', 'desc'),
- 'col' => '*|id',
- ),
-
- 'alls' => array
- (
-
- 'option' => array
- (
- 'name' => array('is_string', 'like'),
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('id', 'desc'),
- 'col' => '*,name as value,name as label|id',
- ),
-
- 'main' => array
- (
- 'where' => array
- (
-
- 'state' => 1,
- ),
- 'option' => array
- (
- 'id' => array('yes', 'in'),
- ),
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => '*|id',
- ),
-
-
- 'child' => array
- (
- 'where' => array
- (
- 'role_id' => array('1', '>='),
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder` desc,`id', 'desc'),
- 'col' => '*|role_id|id|',
- ),
-
-
- '*get' => array
- (
-
- 'where' => array
- (
- 'id' => array('is_string', 'in'),
- ),
- 'type' => 'all',
- 'order' => array('id', 'desc'),
- 'col' => '*',
- ),
-
-
- 'get' => array
- (
-
- 'where' => array
- (
- 'id' => array('is_string', 'in'),
- ),
- 'type' => 'all',
- 'order' => array('id', 'desc'),
- 'col' => '*|id',
- ),
- ),
- );
- $project = Dever::load('manage/auth-project');
- if($project)
- {
- $config['struct']['hr2'] = array
- (
- 'name' => '项目精细权限设置',
- 'class' => '',
- 'attr' => '',
- );
- $project_auth = Dever::load('manage/auth.all');
- foreach($project as $k => $v)
- {
- $config['struct']['auth_' . $v['project']] = array
- (
- 'type' => 'text-255',
- 'name' => $v['project_name'] . '下的权限设置',
- 'default' => '',
- 'desc' => '请选择' . $v['project_name'] . '下的权限设置',
- 'match' => 'option',
- 'update' => 'checkbox',
- 'option' => $project_auth[$v['project']],
- );
- }
- }
- $config['struct']['reorder'] = array
- (
- 'type' => 'int-11',
- 'name' => '排序-数值越大越靠前',
- 'default' => '1',
- 'desc' => '请输入排序',
- 'match' => 'option',
-
- 'search' => 'order',
- 'list' => true,
- 'order' => 'desc',
- 'edit' => true,
- );
- $config['struct']['state'] = array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
-
-
-
-
- );
- $config['struct']['status'] = array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- 'option' => $option,
-
-
-
-
- );
- $config['struct']['cdate'] = array
- (
- 'type' => 'int-11',
- 'name' => '录入时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
-
- 'insert' => true,
-
- 'search' => 'date',
- 'list' => 'date("Y-m-d H:i:s", {cdate})',
- );
- return $config;
|