require roles
This commit is contained in:
parent
59b47db3bf
commit
6c93ec36f9
|
@ -3,9 +3,11 @@ package io.metersphere.controller;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.Project;
|
import io.metersphere.base.domain.Project;
|
||||||
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.service.ProjectService;
|
import io.metersphere.service.ProjectService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -24,22 +26,26 @@ public class ProjectController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
|
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||||
public Project addProject(@RequestBody Project project) {
|
public Project addProject(@RequestBody Project project) {
|
||||||
return projectService.addProject(project);
|
return projectService.addProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/list/{goPage}/{pageSize}")
|
@PostMapping("/list/{goPage}/{pageSize}")
|
||||||
|
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||||
public Pager<List<Project>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize) {
|
public Pager<List<Project>> getProjectList(@PathVariable int goPage, @PathVariable int pageSize) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
return PageUtils.setPageInfo(page, projectService.getProjectList());
|
return PageUtils.setPageInfo(page, projectService.getProjectList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/delete/{projectId}")
|
@GetMapping("/delete/{projectId}")
|
||||||
|
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||||
public void deleteProject(@PathVariable(value = "projectId") String projectId) {
|
public void deleteProject(@PathVariable(value = "projectId") String projectId) {
|
||||||
projectService.deleteProject(projectId);
|
projectService.deleteProject(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
|
@RequiresRoles(RoleConstants.TEST_MANAGER)
|
||||||
public void updateProject(@RequestBody Project Project) {
|
public void updateProject(@RequestBody Project Project) {
|
||||||
projectService.updateProject(Project);
|
projectService.updateProject(Project);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,11 @@ package io.metersphere.controller;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.Workspace;
|
import io.metersphere.base.domain.Workspace;
|
||||||
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.service.WorkspaceService;
|
import io.metersphere.service.WorkspaceService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -18,16 +20,19 @@ public class WorkspaceController {
|
||||||
private WorkspaceService workspaceService;
|
private WorkspaceService workspaceService;
|
||||||
|
|
||||||
@PostMapping("save")
|
@PostMapping("save")
|
||||||
|
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||||
public Workspace saveWorkspace(@RequestBody Workspace workspace) {
|
public Workspace saveWorkspace(@RequestBody Workspace workspace) {
|
||||||
return workspaceService.saveWorkspace(workspace);
|
return workspaceService.saveWorkspace(workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("delete/{workspaceId}")
|
@GetMapping("delete/{workspaceId}")
|
||||||
|
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||||
public void saveWorkspace(@PathVariable String workspaceId) {
|
public void saveWorkspace(@PathVariable String workspaceId) {
|
||||||
workspaceService.deleteWorkspace(workspaceId);
|
workspaceService.deleteWorkspace(workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("list/{goPage}/{pageSize}")
|
@PostMapping("list/{goPage}/{pageSize}")
|
||||||
|
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||||
public Pager<List<Workspace>> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) {
|
public Pager<List<Workspace>> getWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
return PageUtils.setPageInfo(page, workspaceService.getWorkspaceList());
|
return PageUtils.setPageInfo(page, workspaceService.getWorkspaceList());
|
||||||
|
|
Loading…
Reference in New Issue