log 파일 추가, 권한별 메뉴 기능 추가
This commit is contained in:
@@ -85,12 +85,12 @@ public class MenuApiController {
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping("/auth")
|
||||
public ApiResponseDto<Void> getFindByRoleRedis() {
|
||||
public ApiResponseDto<String> getFindByRoleRedis() {
|
||||
menuService.getFindByRoleRedis();
|
||||
return ApiResponseDto.createOK(null);
|
||||
return ApiResponseDto.createOK("ok");
|
||||
}
|
||||
|
||||
@Operation(summary = "권한별 메뉴 조회", description = "권한별 메뉴 조회")
|
||||
@Operation(summary = "권한별 메뉴 조회", description = "로그인 권한별 메뉴 목록")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -61,4 +62,15 @@ public class MenuDto {
|
||||
this.menuApiUrl = menuApiUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public static class MenuWithRolesDto {
|
||||
|
||||
private String menuUid;
|
||||
private String menuNm;
|
||||
private String menuUrl;
|
||||
private String menuApiUri;
|
||||
private String roles; // "ROLE_A,ROLE_B"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,16 @@ public class MenuService {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
List<MenuDto.MenuWithRolesDto> menusWithRoles = menuCoreService.getMenuWithRoles();
|
||||
|
||||
try {
|
||||
String key = "auth:api:role";
|
||||
String value = objectMapper.writeValueAsString(menusWithRoles);
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user