public function ajaxDeleteAction() { $path = Request::getPOST('path', ''); if (empty($path)) { $this->renderAjax(1, '参数错误!'); } RootRelationInterface::deleteByPath(array('path' => $path)); $this->setNotice(FrameworkVars::NOTICE_SUCCESS, '操作成功!'); $this->renderAjax(0); }
public function ajaxRemoveAction() { $managerId = Request::getPOST('manager-id', 0); $path = Request::getPOST('path', ''); if (empty($managerId) || empty($path)) { $this->renderAjax(1, '参数错误!'); } if (!RootPermissionInterface::isValidPath(array('path' => $path))) { $this->renderAjax(1, '路径不合法!'); } // 路径不存在 $where = array(array('manager_id', '=', $managerId), array('path', '=', $path)); $rowInfo = RootRelationInterface::getRow(array('where' => $where)); if (empty($rowInfo)) { $this->renderAjax(1, '管理员权限路径不存在!'); } // 删除 RootRelationInterface::deleteById(array('id' => $rowInfo['id'])); $this->setNotice(FrameworkVars::NOTICE_SUCCESS, '移除权限成功!'); $this->renderAjax(0); }
public static function getIncludeManagerIds($path) { // 对path处理 $path = rtrim($path, '/') . '/'; $relationList = RootRelationInterface::getList(); foreach ($relationList as $i => $rowInfo) { $val = rtrim($rowInfo['path'], '/') . '/'; if (0 === strpos($val, $path)) { continue; } unset($relationList[$i]); } return array_column($relationList, 'manager_id'); }