refactor: unify bag and admin layout routing

This commit is contained in:
taekyoungc
2026-04-08 00:18:01 +09:00
parent 5b0c3fac97
commit 89f80edc5d
15 changed files with 832 additions and 354 deletions

View File

@@ -43,11 +43,49 @@ class Roles extends BaseConfig
}
/**
* 기본코드(종류·세부) 등록·수정·삭제 가능 (지자체·super·본부 관리자)
* 기본코드(종류·세부) 등록·수정·삭제 가능 (super admin(4) · 본부 관리자(5)만)
*/
public static function canManageCodeMaster(int $level): bool
{
return $level === self::LEVEL_LOCAL_ADMIN || self::isSuperAdminEquivalent($level);
return self::isSuperAdminEquivalent($level);
}
/**
* 기본코드 종류(code_kind) CRUD — super·본부만
*/
public static function canManageCodeKindMaster(int $level): bool
{
return self::isSuperAdminEquivalent($level);
}
/**
* 플랫폼 공통 세부코드(CSV·시드) 수정·삭제 — super·본부만
*/
public static function canEditPlatformCodeDetail(int $level): bool
{
return self::isSuperAdminEquivalent($level);
}
/**
* 세부코드 행 단위 수정/삭제 가능 여부
*
* @param object $row code_detail (cd_source, cd_lg_idx)
*/
public static function canEditCodeDetailRow(int $level, object $row, ?int $adminEffectiveLgIdx): bool
{
if (! self::canManageCodeMaster($level)) {
return false;
}
$src = $row->cd_source ?? 'platform';
$lg = (int) ($row->cd_lg_idx ?? 0);
if ($src === 'platform' && $lg === 0) {
return self::canEditPlatformCodeDetail($level);
}
if (self::isSuperAdminEquivalent($level)) {
return true;
}
return $adminEffectiveLgIdx !== null && $adminEffectiveLgIdx > 0 && $lg === $adminEffectiveLgIdx;
}
/**