관리자 initUriData 수정
This commit is contained in:
@@ -73,33 +73,30 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
final String ADMIN_ADD_ONS_SEND_EMAIL = "uri.admin.addons.email";
|
||||
final String ADMIN_ADD_ONS_SEND_EMAIL_CREATE = "uri.admin.addons.email.create";
|
||||
|
||||
// 조사원 메뉴
|
||||
final String ADMIN_RESEARCHER = "uri.admin.researcher";
|
||||
// 임가현황 메뉴
|
||||
final String ADMIN_HOUSEHOLD = "uri.admin.household"; // 1depth
|
||||
final String ADMIN_HOUSEHOLD_STATUS = "uri.admin.household.households"; // 2depth 임가 리스트
|
||||
final String ADMIN_HOUSEHOLD_STATUS_CREATE = "uri.admin.household.households.create"; // 임가 등록
|
||||
final String ADMIN_HOUSEHOLD_STATUS_VIEW = "uri.admin.household.households.view.{{pathVar}}"; // 임가 상세
|
||||
|
||||
final String ADMIN_RESEARCHER_HOUSEHOLD = "uri.admin.researcher.household";
|
||||
final String ADMIN_RESEARCHER_HOUSEHOLD_VIEW = "uri.admin.researcher.household.{{pathVar}}";
|
||||
final String ADMIN_RESEARCHER_DASHBOARD = "uri.admin.researcher.dashboard";
|
||||
// 조사원현황 메뉴
|
||||
final String ADMIN_RESEARCHER = "uri.admin.researcher"; // 1depth
|
||||
final String ADMIN_RESEARCHER_STATUS = "uri.admin.researcher.researchers"; // 2depth 조사원 리스트
|
||||
final String ADMIN_RESEARCHER_STATUS_CREATE = "uri.admin.researcher.researchers.create"; // 조사원 등록
|
||||
final String ADMIN_RESEARCHER_STATUS_VIEW = "uri.admin.researcher.researchers.view.{{pathVar}}"; // 조사원 상세
|
||||
|
||||
final String ADMIN_RESEARCHER_RESEARCHER = "uri.admin.researcher.researcher";
|
||||
final String ADMIN_RESEARCHER_RESEARCHER_CREATE = "uri.admin.researcher.researcher.create";
|
||||
final String ADMIN_RESEARCHER_RESEARCHER_UPDATE = "uri.admin.researcher.researcher.update.{{pathVar}}";
|
||||
|
||||
// 연구원 메뉴
|
||||
final String ADMIN_ANALYST = "uri.admin.analyst";
|
||||
final String ADMIN_ANALYST_DASHBOARD = "uri.admin.analyst.dashboard";
|
||||
// 대시보드
|
||||
final String ADMIN_DASHBOARD = "uri.admin.dashboard"; // 1depth
|
||||
final String ADMIN_DASHBOARD_OVERVIEW = "uri.admin.dashboard.overview"; // 2depth
|
||||
|
||||
// 커뮤니케이션 메뉴
|
||||
final String ADMIN_COMMUNICATION = "uri.admin.communication";
|
||||
final String ADMIN_COMMUNICATION_NOTICE = "uri.admin.communication.notice";
|
||||
final String ADMIN_COMMUNICATION_NOTICE_CREATE = "uri.admin.communication.notice.create";
|
||||
final String ADMIN_COMMUNICATION_NOTICE_UPDATE = "uri.admin.communication.notice.update.{{pathVar}}";
|
||||
final String ADMIN_COMMUNICATION_SMS = "uri.admin.communication.sms";
|
||||
|
||||
// 임가회원관리 메뉴
|
||||
final String ADMIN_HOUSEHOLD = "uri.admin.household";
|
||||
final String ADMIN_HOUSEHOLD_HOUSEHOLD = "uri.admin.household.households";
|
||||
final String ADMIN_HOUSEHOLD_HOUSEHOLD_CREATE = "uri.admin.household.households.create";
|
||||
final String ADMIN_HOUSEHOLD_HOUSEHOLD_UPDATE = "uri.admin.household.households.update.{{pathVar}}";
|
||||
final String ADMIN_COMMUNICATION = "uri.admin.communication"; // 1depth
|
||||
final String ADMIN_COMMUNICATION_NOTICE = "uri.admin.communication.notices"; // 2depth 공지사항
|
||||
final String ADMIN_COMMUNICATION_NOTICE_CREATE = "uri.admin.communication.notices.create"; // 공지사항 등록
|
||||
final String ADMIN_COMMUNICATION_NOTICE_UPDATE = "uri.admin.communication.notices.update.{{pathVar}}"; // 공지사항 수정,상세
|
||||
final String ADMIN_COMMUNICATION_SUGGESTION = "uri.admin.communication.suggestions"; // 2depth 건의사항
|
||||
final String ADMIN_COMMUNICATION_SUGGESTION_VIEW = "uri.admin.communication.suggestions.view.{{pathVar}}"; // 건의사항 상세
|
||||
final String ADMIN_COMMUNICATION_SMS = "uri.admin.communication.sms"; // 2depth 문자발송
|
||||
|
||||
// 최상위 URI 정보
|
||||
appendURI(
|
||||
@@ -116,21 +113,30 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN,
|
||||
ADMIN_RESEARCHER,
|
||||
"조사원",
|
||||
"/researcher",
|
||||
ADMIN_HOUSEHOLD,
|
||||
"임가 현황",
|
||||
"/household",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_RESEARCHER"));
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN,
|
||||
ADMIN_ANALYST,
|
||||
"연구원",
|
||||
"/analyst",
|
||||
ADMIN_RESEARCHER,
|
||||
"조사원 현황",
|
||||
"/researcher",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN,
|
||||
ADMIN_DASHBOARD,
|
||||
"대시보드",
|
||||
"/dashboard",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN,
|
||||
@@ -140,15 +146,6 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
true,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN,
|
||||
ADMIN_HOUSEHOLD,
|
||||
"임가회원관리",
|
||||
"/household",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN,
|
||||
@@ -187,47 +184,71 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
// `1` depth URI 정의 - 끝
|
||||
|
||||
|
||||
// 조사원 메뉴 시작
|
||||
// 임가 현황 메뉴 시작
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_RESEARCHER,
|
||||
ADMIN_RESEARCHER_HOUSEHOLD,
|
||||
"임가현황조회",
|
||||
"/researcher/households",
|
||||
ADMIN_HOUSEHOLD,
|
||||
ADMIN_HOUSEHOLD_STATUS,
|
||||
"임가 현황",
|
||||
"/household/households",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_RESEARCHER"));
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_RESEARCHER,
|
||||
ADMIN_RESEARCHER_HOUSEHOLD_VIEW,
|
||||
"임가현황조회 상세",
|
||||
"/researcher/households/{{pathVar}}",
|
||||
ADMIN_HOUSEHOLD,
|
||||
ADMIN_HOUSEHOLD_STATUS_CREATE,
|
||||
"임가 등록",
|
||||
"/household/households/create",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN", "ROLE_RESEARCHER"));
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_HOUSEHOLD,
|
||||
ADMIN_HOUSEHOLD_STATUS_VIEW,
|
||||
"임가 상세",
|
||||
"/household/households/{{pathVar}}",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
// 조사원 현황 메뉴 시작
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_RESEARCHER,
|
||||
ADMIN_RESEARCHER_DASHBOARD,
|
||||
"대시보드",
|
||||
"/researcher/dashboard",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_RESEARCHER"));
|
||||
// 조사원 메뉴 끝
|
||||
|
||||
|
||||
// 연구원 메뉴 시작
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_ANALYST,
|
||||
ADMIN_ANALYST_DASHBOARD,
|
||||
"대시보드",
|
||||
"/analyst/dashboard",
|
||||
ADMIN_RESEARCHER_STATUS,
|
||||
"조사원 현황",
|
||||
"/researcher/researchers",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST"));
|
||||
// 연구원 메뉴 끝
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_RESEARCHER,
|
||||
ADMIN_RESEARCHER_STATUS_CREATE,
|
||||
"조사원 등록",
|
||||
"/researcher/researchers/create",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_RESEARCHER,
|
||||
ADMIN_RESEARCHER_STATUS_VIEW,
|
||||
"조사원 상세",
|
||||
"/researcher/researchers/view/{{pathVar}}",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST"));
|
||||
|
||||
// 대시보드
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_DASHBOARD,
|
||||
ADMIN_DASHBOARD_OVERVIEW,
|
||||
"대시보드",
|
||||
"/dashboard",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
// 커뮤니케이션 메뉴 시작
|
||||
appendURI(
|
||||
@@ -253,7 +274,25 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
ADMIN_COMMUNICATION,
|
||||
ADMIN_COMMUNICATION_NOTICE_UPDATE,
|
||||
"공지사항 수정",
|
||||
"/communication/notices/update/{{pathVar}}",
|
||||
"/communication/notices/{{pathVar}}",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_COMMUNICATION,
|
||||
ADMIN_COMMUNICATION_SUGGESTION,
|
||||
"건의사항",
|
||||
"/communication/suggestions",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_COMMUNICATION,
|
||||
ADMIN_COMMUNICATION_SUGGESTION_VIEW,
|
||||
"건의사항 상세",
|
||||
"/communication/suggestions/view/{{pathVar}}",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
@@ -265,38 +304,6 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
"/communication/sms",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
// 커뮤니케이션 메뉴 끝
|
||||
|
||||
|
||||
// 임가회원관리 메뉴 시작
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_HOUSEHOLD,
|
||||
ADMIN_HOUSEHOLD_HOUSEHOLD,
|
||||
"임가회원",
|
||||
"/household/households",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_HOUSEHOLD,
|
||||
ADMIN_HOUSEHOLD_HOUSEHOLD_CREATE,
|
||||
"임가회원 등록",
|
||||
"/household/households/create",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_HOUSEHOLD,
|
||||
ADMIN_HOUSEHOLD_HOUSEHOLD_UPDATE,
|
||||
"임가회원 수정",
|
||||
"/household/households/update/{{pathVar}}",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN", "ROLE_ANALYST", "ROLE_RESEARCHER"));
|
||||
// 임가회원관리 메뉴 끝
|
||||
|
||||
|
||||
// 예제 게시판 - 시작
|
||||
appendURI(
|
||||
|
||||
@@ -6,17 +6,13 @@ import jakarta.servlet.http.HttpSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.oauth2.core.user.DefaultOAuth2User;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
public class CommonUtil {
|
||||
|
||||
@@ -92,6 +88,17 @@ public class CommonUtil {
|
||||
return username;
|
||||
}
|
||||
|
||||
public static String getLoginUserRole() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null) return null;
|
||||
|
||||
return authentication.getAuthorities().stream()
|
||||
.map(GrantedAuthority::getAuthority)
|
||||
.filter(authStr -> authStr.startsWith("ROLE_"))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public static HttpServletRequest getRequest() {
|
||||
HttpServletRequest request = null;
|
||||
if (RequestContextHolder.getRequestAttributes() != null) {
|
||||
|
||||
Reference in New Issue
Block a user