261102_01_ENH: 프로젝트 접근 권한 확인 API 추가 및 공통 사용자 Context 적용
This commit is contained in:
@@ -5,6 +5,7 @@ import com.kri.kart.server.common.enums.ProjectType;
|
||||
import com.kri.kart.server.dto.project.ProjectRefDto;
|
||||
import com.kri.kart.server.dto.share.ShareLinkDto;
|
||||
import com.kri.kart.server.dto.share.ShareLinkRequestDto;
|
||||
import com.kri.kart.server.service.ProjectService;
|
||||
import com.kri.kart.server.service.ShareLinkService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@ConditionalOnProperty(prefix = "kri.kart.database", name = "enabled", havingValue = "true")
|
||||
public class ShareLinkController {
|
||||
private final ShareLinkService shareLinkService;
|
||||
private final ProjectService projectService;
|
||||
|
||||
@PostMapping("/api/v1/project/{projectType}/{pkey}/share")
|
||||
@Operation(summary = "공유 링크 발급 또는 재사용")
|
||||
@@ -34,7 +36,9 @@ public class ShareLinkController {
|
||||
|
||||
@GetMapping("/api/v1/share/{urlKey}")
|
||||
@Operation(summary = "공유 링크 정보 조회", description = "내부 인증 필요. 랜딩 횟수를 증가시키지 않는다.")
|
||||
public ShareLinkDto lookup(@PathVariable String urlKey) {
|
||||
return shareLinkService.lookup(urlKey);
|
||||
public ShareLinkDto lookup(@PathVariable String urlKey, RequestUserContext ctx) {
|
||||
ShareLinkDto link = shareLinkService.lookup(urlKey);
|
||||
projectService.requireAccess(new ProjectRefDto(link.projectType(), link.pkey()), ctx);
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user