admingroup_auth.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /**
  3. * 编辑管理员组权限
  4. *
  5. * @createtime 2018/03/01
  6. * @author 空竹
  7. * @copyright 芝麻开发(http://www.zhimawork.com)
  8. */
  9. require_once('admin_init.php');
  10. require_once('admincheck.php');
  11. $POWERID = '9001';//权限
  12. Admin::checkAuth($POWERID, $ADMINAUTH);
  13. $id = safeCheck($_GET['id']);
  14. $group = Admingroup::getInfoById($id);
  15. if($group){
  16. $groupId = $group['id'];
  17. $groupName = $group['name'];
  18. $groupAuth = explode('|', $group['auth']);
  19. }else{
  20. die('数据不存在或已被删除');
  21. }
  22. if($groupId == 1) die('超级管理员组不能被设置权限');
  23. ?>
  24. <!DOCTYPE html>
  25. <html>
  26. <head>
  27. <?php include('htmlhead.inc.php');?>
  28. <title>管理员权限修改 - 管理系统 </title>
  29. </head>
  30. <body>
  31. <div id="header">
  32. <?php include('top.inc.php');?>
  33. <?php
  34. $FLAG_TOPNAV = "system";//主菜单焦点
  35. include('nav.inc.php');
  36. ?>
  37. </div>
  38. <div id="container">
  39. <?php
  40. $FLAG_LEFTMENU = 'admingroup_list';//左侧子菜单焦点
  41. include('admin_menu.inc.php');
  42. ?>
  43. <div id="maincontent">
  44. <div class="tablelist">
  45. <h3>编辑“<?php echo $groupName?>”的权限</h3>
  46. <table>
  47. <tr>
  48. <th width="5%">选择</th>
  49. <th width="10%">权限编号</th>
  50. <th width="15%">功能模块</th>
  51. <th width="15%">子模块</th>
  52. <th>说明</th>
  53. </tr>
  54. <tr>
  55. <td rowspan="3"><input type="checkbox" class="checkbox-input" value="9001" <?php if(in_array(9001, $groupAuth)) echo 'checked';?> /></td>
  56. <td rowspan="3">9001</td>
  57. <td rowspan="3">管理员设置</td>
  58. <td>管理员组</td>
  59. <td>管理员组的增、删、改、权限设置、列表</td>
  60. </tr>
  61. <tr>
  62. <td>管理员</td>
  63. <td>管理员的增、删、改、列表</td>
  64. </tr>
  65. <tr>
  66. <td>管理员日志</td>
  67. <td>查看管理员日志</td>
  68. </tr>
  69. <tr>
  70. <td><input type="checkbox" class="checkbox-input" value="9002" <?php if(in_array(9002, $groupAuth)) echo 'checked';?> /></td>
  71. <td>9002</td>
  72. <td>系统信息</td>
  73. <td>-</td>
  74. <td>查看系统安全信息、技术信息、系统日志、调试日志。</td>
  75. </tr>
  76. </table>
  77. </div>
  78. <div class="zm_form_wrap">
  79. <p class="center">
  80. <input type="submit" id="btn_submit" class="btn_submit" value="保存" />
  81. <input type="button" id="btn_back" class="btn btn_back" value="返回"/>
  82. <input type="hidden" id="gid" value="<?php echo $groupId;?>" />
  83. </p>
  84. </div>
  85. </div>
  86. <div class="clear"></div>
  87. </div>
  88. <?php include('footer.inc.php');?>
  89. <script type="text/javascript">
  90. $(function(){
  91. // 返回
  92. $('#btn_back').click(function(){
  93. window.location.href = 'admingroup_list.php';
  94. });
  95. $('#btn_submit').click(function(){
  96. var powernum = $('.tablelist td > .checkbox-input').length;
  97. var powerlist = '';
  98. var id = $("#gid").val();
  99. for(i=0; i<powernum; i++){
  100. if($('.tablelist td > .checkbox-input').eq(i).prop('checked')){
  101. powerlist = $('.tablelist td > .checkbox-input').eq(i).val() + '|' + powerlist;
  102. }
  103. }
  104. $.getJSON('admingroup_do.php?act=updateauth',{id : id, auth : powerlist},function(data){
  105. var code = data.code;
  106. var msg = data.msg;
  107. switch(code){
  108. case 1:
  109. layer.alert(msg, {icon: 6}, function(index){
  110. location.reload();
  111. });
  112. break;
  113. default:
  114. layer.alert(msg, {icon: 5});
  115. }
  116. });
  117. });
  118. });
  119. </script>
  120. </body>
  121. </html>