Skip to content

Commit

Permalink
#21 - Feat: 관리자 홈 메인 페이지 추가, username이 admin인 회원을 관리자 회원으로 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
ahah525 committed Oct 30, 2022
1 parent 0e55756 commit 52abaed
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.mutbooks.app.home.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/adm")
public class AdminHomeController {
@GetMapping("")
@PreAuthorize("hasAuthority('ADMIN')")
public String showIndex() {
return "redirect:/adm/home/main";
}

// 관리자 메인페이지
@GetMapping("/home/main")
@PreAuthorize("hasAuthority('ADMIN')")
public String showMain() {
return "adm/home/main";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class MemberService {
@Transactional
public Member join(JoinForm joinForm) {
int authLevel = 3; // 디폴트 일반 권한
// TODO: username 이 admin 인 회원을 관리자 회원으로 설정
if(joinForm.getUsername().equals("admin")) {
authLevel = 7;
}

// 기본 권한 = 일반
Member member = Member.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public void handleError(ClientHttpResponse response) {
});
}

// TODO: secret key ignore 처리
private final String SECRET_KEY = "test_sk_jkYG57Eba3GlOkbXE5lVpWDOxmA1";

// 결제 성공 리다이렉트 URL
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html layout:decorate="~{/layout/layout}">

<head>
<title>관리자 메인</title>
</head>

<main layout:fragment="main">
<div class="container mx-auto flex-grow flex items-center justify-center">
<h1>관리자 메인페이지</h1>
</div>
</main>

</html>

0 comments on commit 52abaed

Please sign in to comment.