fix(auth): AccountController 添加公司拥有者权限限制

- 创建账户接口添加 @RequireRole(allowUser = false)
- 更新账户接口添加 @RequireRole(allowUser = false)

现在这些接口只有公司拥有者(super admin 和 owner)可以调用
This commit is contained in:
小蟑螂
2026-03-29 23:28:21 +08:00
parent f31d8ff540
commit d8db15148d
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
import top.xyquan.ecomdmbbackend.common.annotation.RequireRole;
import top.xyquan.ecomdmbbackend.common.response.ApiResponse;
import top.xyquan.ecomdmbbackend.common.model.dto.PageQueryDTO;
import top.xyquan.ecomdmbbackend.common.model.vo.PageResultVO;
@@ -30,6 +31,7 @@ public class AccountController {
@Operation(summary = "创建账户(管理员)", description = "公司管理员创建本公司账户")
@PostMapping("/create")
@RequireRole(description = "创建账户", allowUser = false)
public ApiResponse<AccountVO> createAccountForCompany(@Valid @RequestBody CreateAccountDTO createAccountDTO) {
AccountVO accountVO = accountService.createAccountForCompany(createAccountDTO);
return ApiResponse.success(accountVO);
@@ -44,6 +46,7 @@ public class AccountController {
@Operation(summary = "更新账户信息", description = "公司管理员更新本公司账户信息")
@PutMapping("/update/{accountId}")
@RequireRole(description = "更新账户", allowUser = false)
public ApiResponse<AccountVO> updateAccount(
@Parameter(description = "账户ID", example = "1") @PathVariable Long accountId,
@Valid @RequestBody UpdateAccountDTO updateAccountDTO) {