|
|
@@ -6,7 +6,7 @@ import cn.reghao.oss.sdk.model.constant.ObjectScope;
|
|
|
import cn.reghao.oss.api.dto.ObjectChannel;
|
|
|
import cn.reghao.oss.api.dto.ObjectMeta;
|
|
|
import cn.reghao.oss.store.db.repository.ObjectRepository;
|
|
|
-import cn.reghao.oss.store.service.ConsoleCache;
|
|
|
+import cn.reghao.oss.store.service.ConsoleServiceWrapper;
|
|
|
import cn.reghao.oss.store.service.GetObjectService;
|
|
|
import cn.reghao.oss.api.util.JwtUtil;
|
|
|
import cn.reghao.oss.store.util.ObjectUtil;
|
|
|
@@ -29,14 +29,14 @@ import java.io.IOException;
|
|
|
public class ObjectGetController {
|
|
|
private final GetObjectService getObjectService;
|
|
|
private final ObjectRepository objectRepository;
|
|
|
- private final ConsoleCache consoleCache;
|
|
|
+ private final ConsoleServiceWrapper consoleServiceWrapper;
|
|
|
private final Cache<String, String> cache;
|
|
|
|
|
|
public ObjectGetController(GetObjectService getObjectService, ObjectRepository objectRepository,
|
|
|
- ConsoleCache consoleCache, Cache<String, String> cache) {
|
|
|
+ ConsoleServiceWrapper consoleServiceWrapper, Cache<String, String> cache) {
|
|
|
this.getObjectService = getObjectService;
|
|
|
this.objectRepository = objectRepository;
|
|
|
- this.consoleCache = consoleCache;
|
|
|
+ this.consoleServiceWrapper = consoleServiceWrapper;
|
|
|
this.cache = cache;
|
|
|
}
|
|
|
|
|
|
@@ -60,7 +60,7 @@ public class ObjectGetController {
|
|
|
@RequestParam(value = "client", required = false) String client) throws IOException {
|
|
|
String objectName = ObjectUtil.getObjectName();
|
|
|
String domain = ServletUtil.getHeader("host");
|
|
|
- int owner = consoleCache.getNodeProperties(domain).getOwner();
|
|
|
+ int owner = consoleServiceWrapper.getNodeProperties(domain).getOwner();
|
|
|
ObjectMeta objectMeta = objectRepository.getObjectMetaByName(objectName, owner);
|
|
|
if (objectMeta == null) {
|
|
|
getObjectService.writeResponse(HttpServletResponse.SC_NOT_FOUND);
|
|
|
@@ -107,7 +107,7 @@ public class ObjectGetController {
|
|
|
OssPayload ossPayload = JwtUtil.getOssPayload(token, secretKey);
|
|
|
int loginUser = ossPayload.getUserId();
|
|
|
int channelCode = ossPayload.getChannelCode();
|
|
|
- ObjectChannel objectChannel = consoleCache.getChannelByCode(loginUser, channelCode);
|
|
|
+ ObjectChannel objectChannel = consoleServiceWrapper.getChannelByCode(loginUser, channelCode);
|
|
|
if (objectChannel == null) {
|
|
|
String payload = String.format("channel_id %s not exist", channelCode);
|
|
|
getObjectService.writeResponse(HttpServletResponse.SC_FORBIDDEN, payload);
|