workspace check owner
This commit is contained in:
parent
6c93ec36f9
commit
40f0159f89
|
@ -19,15 +19,23 @@ public class WorkspaceController {
|
||||||
@Resource
|
@Resource
|
||||||
private WorkspaceService workspaceService;
|
private WorkspaceService workspaceService;
|
||||||
|
|
||||||
@PostMapping("save")
|
@PostMapping("add")
|
||||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||||
public Workspace saveWorkspace(@RequestBody Workspace workspace) {
|
public Workspace addWorkspace(@RequestBody Workspace workspace) {
|
||||||
|
return workspaceService.saveWorkspace(workspace);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("update")
|
||||||
|
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||||
|
public Workspace updateWorkspace(@RequestBody Workspace workspace) {
|
||||||
|
workspaceService.checkOwner(workspace.getId());
|
||||||
return workspaceService.saveWorkspace(workspace);
|
return workspaceService.saveWorkspace(workspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("delete/{workspaceId}")
|
@GetMapping("delete/{workspaceId}")
|
||||||
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
@RequiresRoles(RoleConstants.ORG_ADMIN)
|
||||||
public void saveWorkspace(@PathVariable String workspaceId) {
|
public void saveWorkspace(@PathVariable String workspaceId) {
|
||||||
|
workspaceService.checkOwner(workspaceId);
|
||||||
workspaceService.deleteWorkspace(workspaceId);
|
workspaceService.deleteWorkspace(workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,4 +45,9 @@ public class WorkspaceService {
|
||||||
public void deleteWorkspace(String workspaceId) {
|
public void deleteWorkspace(String workspaceId) {
|
||||||
workspaceMapper.deleteByPrimaryKey(workspaceId);
|
workspaceMapper.deleteByPrimaryKey(workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkOwner(String workspaceId) {
|
||||||
|
// TODO 验证当前用户是否拥有当前此空间权限
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,12 +77,16 @@
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.$post("/workspace/save", this.form, () => {
|
let saveType = 'add';
|
||||||
|
if (this.form.id) {
|
||||||
|
saveType = 'update'
|
||||||
|
}
|
||||||
|
this.$post("/workspace/" + saveType, this.form, () => {
|
||||||
this.createVisible = false;
|
this.createVisible = false;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.list();
|
this.list();
|
||||||
Message.success('保存成功');
|
Message.success('保存成功');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue