public function iframeRemoveAction()
 {
     $managerId = Request::getGET('manager-id', 0);
     $managerInfo = RootManagerInterface::getById(array('id' => $managerId));
     if (empty($managerInfo)) {
         $this->renderIframeError('管理员不存在!');
     }
     $userInfo = UserCommonInterface::getById(array('id' => $managerInfo['user_id']));
     $this->renderIframe(array('userInfo' => $userInfo), 'manager/iframe/remove_path.php');
 }
 public static function save($data, $id = 0)
 {
     if (0 == $id) {
         $path = $data['path'];
         $managerId = $data['manager_id'];
         // 判断manager是否存在
         $managerInfo = RootManagerInterface::getById(array('id' => $managerId));
         if (empty($managerInfo)) {
             throw new InterfaceException('管理员不存在!');
         }
         // 判断路径是否存在
         if (!RootPermissionInterface::findPath(array('path' => $path))) {
             throw new InterfaceException('路径不存在!');
         }
         // 判断是否已经添加
         $check = RootManagerInterface::checkPermission(array('id' => $managerId, 'path' => $path));
         if ($check) {
             return 0;
         }
         $trans = new Trans(DbConfig::$SERVER_TRANS);
         $trans->begin();
         $model = new RootRelationModel($trans);
         // 删除重复权限
         $dir = rtrim($path, '/') . '/';
         $where = array(array('manager_id', '=', $managerId), array('path', 'LIKE', "{$dir}%"));
         $model->delete($where);
         $insertData = $data;
         $id = $model->insert($insertData);
         $trans->commit();
         self::syncToRedis($managerId);
         return $id;
     } else {
         $model = new RootRelationModel();
         $updateData = $data;
         $affects = $model->updateById($id, $updateData);
         return $affects;
     }
 }
 public function ajaxDeleteAction()
 {
     $managerId = Request::getPOST('manager-id', 0);
     // 校验
     $managerInfo = RootManagerInterface::getById(array('id' => $managerId));
     if (empty($managerInfo)) {
         $this->renderAjax(1, '信息不存在!');
     }
     // 删除
     RootManagerInterface::deleteById(array('id' => $managerId));
     $this->setNotice(FrameworkVars::NOTICE_SUCCESS, '删除成功!');
     $this->renderAjax(0);
 }