Skip to content

Commit

Permalink
refactor(FileService, AuthUtil): 불필요한 주석 제거, 공백 제거 #502
Browse files Browse the repository at this point in the history
  • Loading branch information
mingmingmon committed Aug 25, 2024
1 parent 4856d18 commit c1f9c88
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
2 changes: 1 addition & 1 deletion src/main/java/page/clab/api/global/auth/util/AuthUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down

0 comments on commit c1f9c88

Please sign in to comment.