feat: TOTP 2차 인증, 관리자 메뉴/대시보드 및 의존성 반영
- robthree/twofactorauth, Auth 설정·TotpService·2FA 뷰·라우트 - member TOTP 컬럼 DDL(login_tables, member_add_totp.sql) - 관리자 메뉴·레이아웃·필터·대시보드 등 연관 변경 - env 샘플에 auth.requireTotp 주석 Made-with: Cursor
This commit is contained in:
@@ -11,7 +11,7 @@ use Config\Roles;
|
||||
|
||||
/**
|
||||
* 관리자 전용 접근 필터.
|
||||
* logged_in 이고 mb_level 이 SUPER_ADMIN(4) 또는 LOCAL_ADMIN(3) 일 때만 통과.
|
||||
* logged_in 이고 mb_level 이 SUPER_ADMIN(4)·HEADQUARTERS_ADMIN(5)·LOCAL_ADMIN(3) 일 때만 통과.
|
||||
*/
|
||||
class AdminAuthFilter implements FilterInterface
|
||||
{
|
||||
@@ -22,15 +22,16 @@ class AdminAuthFilter implements FilterInterface
|
||||
}
|
||||
|
||||
$level = (int) session()->get('mb_level');
|
||||
if ($level !== Roles::LEVEL_SUPER_ADMIN && $level !== Roles::LEVEL_LOCAL_ADMIN) {
|
||||
$isAdminLevel = Roles::isSuperAdminEquivalent($level) || $level === Roles::LEVEL_LOCAL_ADMIN;
|
||||
if (! $isAdminLevel) {
|
||||
return redirect()->to(site_url('/'))->with('error', '관리자만 접근할 수 있습니다.');
|
||||
}
|
||||
|
||||
// Super admin: 지자체 미선택 시 지자체 선택 페이지로 유도 (지자체 선택·지자체 CRUD는 미선택도 허용)
|
||||
// Super/본부: 지자체 미선택 시 지자체 선택 페이지로 유도 (지자체 선택·지자체 CRUD는 미선택도 허용)
|
||||
$uri = $request->getUri();
|
||||
$seg2 = $uri->getSegment(2);
|
||||
$allowedWithoutSelection = ['select-local-government', 'local-governments'];
|
||||
if ($level === Roles::LEVEL_SUPER_ADMIN && ! in_array($seg2, $allowedWithoutSelection, true)) {
|
||||
if (Roles::isSuperAdminEquivalent($level) && ! in_array($seg2, $allowedWithoutSelection, true)) {
|
||||
$selected = session()->get('admin_selected_lg_idx');
|
||||
if ($selected === null || $selected === '') {
|
||||
return redirect()->to(site_url('admin/select-local-government'))->with('error', '작업할 지자체를 먼저 선택해 주세요.');
|
||||
|
||||
Reference in New Issue
Block a user