|
|
@@ -4,9 +4,7 @@ import cn.reghao.dfs.store.db.repository.ObjectRepository;
|
|
|
import cn.reghao.dfs.store.model.po.FileMeta;
|
|
|
import cn.reghao.dfs.store.util.UserContext;
|
|
|
import cn.reghao.oss.api.constant.ObjectACL;
|
|
|
-import cn.reghao.tnb.account.api.iface.UserQuery;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.lang.Nullable;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.servlet.HandlerInterceptor;
|
|
|
@@ -26,8 +24,6 @@ import java.nio.charset.StandardCharsets;
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
public class AccessLogInterceptor implements HandlerInterceptor {
|
|
|
- @DubboReference(check = false)
|
|
|
- private UserQuery userQuery;
|
|
|
private final ObjectRepository objectRepository;
|
|
|
|
|
|
public AccessLogInterceptor(ObjectRepository objectRepository) {
|
|
|
@@ -48,7 +44,6 @@ public class AccessLogInterceptor implements HandlerInterceptor {
|
|
|
|
|
|
private boolean checkPermission(String method, String uri, HttpServletResponse response) {
|
|
|
long userId = UserContext.getUser();
|
|
|
- //UserPermission userPermission = userQuery.getUserPermission(userId);
|
|
|
if (method.equals("GET") || method.equals("HEAD")) {
|
|
|
String objectName = URLDecoder.decode(uri, StandardCharsets.UTF_8).replaceFirst("/", "");
|
|
|
FileMeta fileMeta = objectRepository.getByObjectName(objectName);
|
|
|
@@ -69,7 +64,7 @@ public class AccessLogInterceptor implements HandlerInterceptor {
|
|
|
} else if (acl == ObjectACL.PUBLIC.getCode()) {
|
|
|
return true;
|
|
|
} else if (acl == ObjectACL.FRIEND.getCode()) {
|
|
|
- return userQuery.isFriend(userId, uploadBy);
|
|
|
+ return false;
|
|
|
}
|
|
|
} else if (method.equals("PUT") || method.equals("POST")) {
|
|
|
if (userId == -1) {
|