diff --git a/src/main/java/page/clab/api/global/auth/util/AuthUtil.java b/src/main/java/page/clab/api/global/auth/util/AuthUtil.java index 362689e5b..3c59dc090 100644 --- a/src/main/java/page/clab/api/global/auth/util/AuthUtil.java +++ b/src/main/java/page/clab/api/global/auth/util/AuthUtil.java @@ -23,7 +23,7 @@ public static String getAuthenticationInfoMemberId() { return getAuthenticationInfo().getUsername(); } - public static Boolean isUserUnAuthenticated (Authentication authentication) { + public static Boolean isUserUnAuthenticated(Authentication authentication) { return (authentication == null || authentication.getAuthorities() == null || authentication.getAuthorities().isEmpty()); } } diff --git a/src/main/java/page/clab/api/global/common/file/application/FileService.java b/src/main/java/page/clab/api/global/common/file/application/FileService.java index e2f5c9651..2f165e264 100644 --- a/src/main/java/page/clab/api/global/common/file/application/FileService.java +++ b/src/main/java/page/clab/api/global/common/file/application/FileService.java @@ -223,42 +223,6 @@ private boolean isAssignmentAccessible(String url, Authentication authentication activityGroupAdminService.isMemberGroupLeaderRole(activityGroupId, authentication.getName()); } -/* public boolean isUserAccessibleByCategory(String category, String url, Authentication authentication) { - - if (category.equals("activity-photos")) { - return true; - } - - if (authentication == null || authentication.getAuthorities() == null || authentication.getAuthorities().isEmpty()) - return false; - - UploadedFile uploadedFile = uploadedFileService.getUploadedFileByUrl(url); - String uploaderId = uploadedFile.getUploader(); - GrantedAuthority authority = authentication.getAuthorities().iterator().next(); - String roleName = authority.getAuthority().replace("ROLE_", ""); - Role role = Role.valueOf(roleName); - - if (!roleCategoryMap.getOrDefault(role, Set.of()).contains(category)) { - return false; - } - - switch (category) { - case "boards", "profiles", "membership-fee", "activity-photos": - return true; - - case "members": - return (authentication.getName().equals(uploaderId)); - - case "assignments": - String[] parts = url.split("/"); - Long activityGroupId = Long.parseLong(parts[4]); - return (authentication.getName().equals(uploaderId) || - activityGroupAdminService.isMemberGroupLeaderRole(activityGroupId, authentication.getName())); - default: - return false; - } - }*/ - private String getCategoryByUrl(String url) { String basePath = fileURL + "/"; String category = "";