/**
  * 编辑界面展示
  */
 public function editAction()
 {
     $rid = $this->getInput('rid');
     $role = $this->_loadRoleService()->findRoleById($rid);
     if ($role instanceof PwError) {
         $this->showError($role->getError());
     }
     /* @var $menuService AdminMenuService */
     $menuService = Wekit::load('ADMIN:service.srv.AdminMenuService');
     $auths = $menuService->getMenuTable();
     $auths = AdminMenuHelper::resetMenuStruts($auths);
     //remove the admin right setting
     unset($auths['admin']);
     $roles = $this->_loadRoleService()->findRoles();
     $_tmp = array();
     foreach ($roles as $value) {
         $_tmp[$value['name']] = empty($value['auths']) ? array() : explode(',', $value['auths']);
     }
     $_cAuths = $_tmp[$role['name']];
     $this->setOutput($_tmp, 'roleTable');
     $this->setOutput($roles, 'roles');
     $this->setOutput($_cAuths, 'cAuths');
     $this->setOutput($role, 'role');
     $this->setOutput($auths, 'auths');
 }
 public function run()
 {
     $menuService = Wekit::load('ADMIN:service.srv.AdminMenuService');
     $userService = Wekit::load('ADMIN:service.srv.AdminUserService');
     $myMenus = $userService->getAuths($this->loginUser);
     $menuTables = $menuService->getMenuTable();
     if ($myMenus !== '-1') {
         foreach ($menuTables as $key => $value) {
             if (isset($value['url']) && !in_array($key, (array) $myMenus)) {
                 unset($menuTables[$key]);
             }
         }
     }
     $menus = AdminMenuHelper::resetMenuStruts($menuTables);
     foreach ($menus as $key => $value) {
         if (isset($value['items']) && empty($value['items'])) {
             unset($menus[$key]);
         }
     }
     $this->setOutput($menus, 'menus');
     $myMenu = $this->_loadCustomDs()->findByUsername($this->loginUser->username);
     $this->setOutput($myMenu ? explode(',', $myMenu['custom']) : array(), 'myMenu');
 }