Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 사용되지 않는 기능 제거 및 권한 에러 수정 #31

Merged
merged 3 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- hot-fix

jobs:
deploy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public FolderContentsDto getFolderContents(@CheckField(value = FieldType.FOLDER_
@PatchMapping("/{folderId}")
public void moveFolder(@PathVariable("folderId") @CheckField(value = FieldType.FOLDER_ID) Long sourceFolderId,
@CheckDto @RequestBody FolderMoveDto dto) {
folderService.checkFolderOwnedBy(sourceFolderId, dto.userId());
folderService.checkFolderOwnedBy(dto.targetFolderId(), dto.userId());
// folderService.checkFolderOwnedBy(sourceFolderId, dto.userId());
// folderService.checkFolderOwnedBy(dto.targetFolderId(), dto.userId());
folderService.moveFolder(sourceFolderId, dto);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,18 @@ private void validateExpiredAndPermission(LocalDateTime sharingExpiredAt, LocalD
Long userId, PermissionType sharedPermissionType, PermissionType permissionType) {
// 공유 기한이 지났는데 파일에 대한 소유주가 아닌 경우 예외를 반환한다.
if (sharingExpiredAt.isBefore(now) && !Objects.equals(userId, ownerId)) {
log.error(
"[SharingExpired Exception] 권한 검증 중, 공유 기한이 지나고 파일 소유주가 아닌 예외 발생. request user id = {}, file owner id = {}",
userId, ownerId);
throw ErrorCode.ACCESS_DENIED.baseException();
}

// 읽기 권한만 있는 파일에 쓰기 작업을 시도하면 예외를 반환한다.
if (Objects.equals(permissionType, PermissionType.WRITE) && Objects.equals(sharedPermissionType,
PermissionType.READ)) {
log.error(
"[PermissionType Exception] 읽기 권한이 있는 사용자가 쓰기 권한 요청하여 예외 발생.request user id = {}, file owner id = {}",
userId, ownerId);
throw ErrorCode.ACCESS_DENIED.baseException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CommonConstant {
public static final long SHARED_LINK_VALID_TIME = 3;
// 1MB
public static final int THUMBNAIL_SIZE = 1024 * 1024;
public static final LocalDateTime UNAVAILABLE_TIME = LocalDateTime.of(1970, 1, 1, 1, 0);
public static final LocalDateTime UNAVAILABLE_TIME = LocalDateTime.of(1971, 1, 1, 1, 0);
public static final String SHARED_LINK_URI = "/api/v1/share?sharedId=";
public static final String FOLDER_READ_URI = "/api/v1/folders/";
public static final String FILE_READ_URI = "/api/v1/files/";
Expand Down
Loading