Пример #1
0
 /**
  * 权限列表
  */
 public function action_assign()
 {
     $this->template->roles = $roles = $this->role->getAll();
     $this->template->roleId = $roleId = (int) $this->getQuery('role_id');
     if ($roleId == 0) {
         $this->template->roleId = $roles[0]['role_id'];
         //获取第一个角色
     } elseif (!$this->role->idExists($roleId)) {
         $this->show_message('发生错误:指定的角色 ID 不存在或者已经被删除');
     }
     $this->template->layout['title'] = $this->acl->modDesc . ' - 权限指派';
     $this->template->ruleGroup = $this->rule->getRuleGroup();
     $this->template->allowRules = $allowRules = $this->acl->getRoleAllowRule($roleId);
 }
Пример #2
0
 /**
  * 删除角色
  */
 public function action_del()
 {
     if (!Auth::getInstance()->isAllow('role.delete')) {
         $this->show_message("对不起,您没有权限执行该操作");
     }
     try {
         $this->role->delRole($this->getQuery('role_id'));
         $this->request->redirect('/admin/role/list?mod_name=' . trim($this->getQuery('mod_name')));
     } catch (Exception $e) {
         $this->show_message('操作失败:' . $e->getMessage());
     }
     $this->auto_render = false;
 }