feat: add permission control to databaseType api
This commit is contained in:
parent
a6aed7ac4e
commit
697ce840e0
|
@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -42,6 +43,7 @@ public class DatabaseTypeController {
|
|||
|
||||
@PostMapping(Routes.DatabaseType.CREATE)
|
||||
@Operation(module = Operation.Modules.DATABASE_TYPE, name = "创建数据库类型")
|
||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
||||
public JsonData<Integer> create(@RequestBody @Valid DatabaseTypeCreateRequest request) {
|
||||
databaseTypeValidator.isValidUrlPattern(request.getUrlPattern());
|
||||
Integer id = databaseTypeService.create(request);
|
||||
|
@ -50,6 +52,7 @@ public class DatabaseTypeController {
|
|||
|
||||
@PatchMapping(Routes.DatabaseType.UPDATE)
|
||||
@Operation(module = Operation.Modules.DATABASE_TYPE, name = "更新数据库类型")
|
||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
||||
public JsonData<Void> update(@RequestBody @Valid DatabaseTypeUpdateRequest request) {
|
||||
databaseTypeValidator.isValidUrlPattern(request.getUrlPattern());
|
||||
databaseTypeService.update(request);
|
||||
|
@ -58,6 +61,7 @@ public class DatabaseTypeController {
|
|||
|
||||
@DeleteMapping(Routes.DatabaseType.DELETE_ONE)
|
||||
@Operation(module = Operation.Modules.DATABASE_TYPE, name = "删除数据库类型")
|
||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER')")
|
||||
public JsonData<Void> delete(@PathVariable Integer id) {
|
||||
databaseTypeService.deleteById(id);
|
||||
return JsonData.ok();
|
||||
|
|
Loading…
Reference in New Issue