역할 관리 페이지 개선

- 역할 목록: 테넌트/Guard 컬럼 추가, Guard 필터 드롭다운 추가
- 역할 등록/수정: Guard 선택 기능 추가 (API/Web)
- 권한 선택 UI를 메뉴 기반 매트릭스로 변경 (7가지 권한 유형)
- 테넌트 미선택 시 역할 등록 차단
- pagination.js 디버그 로그 제거
This commit is contained in:
2025-11-26 17:11:17 +09:00
parent f029d78614
commit ee9e645290
10 changed files with 365 additions and 124 deletions

View File

@@ -22,6 +22,7 @@ public function rules(): array
{
$tenantId = session('selected_tenant_id');
$roleId = $this->route('id'); // URL 파라미터에서 role ID 가져오기
$guardName = $this->input('guard_name', 'api');
return [
'name' => [
@@ -30,12 +31,14 @@ public function rules(): array
'max:100',
Rule::unique('roles', 'name')
->where('tenant_id', $tenantId)
->where('guard_name', 'web')
->where('guard_name', $guardName)
->ignore($roleId),
],
'guard_name' => 'required|in:api,web',
'description' => 'nullable|string|max:500',
'permissions' => 'nullable|array',
'permissions.*' => 'exists:permissions,id',
'menu_permissions' => 'nullable|array',
'menu_permissions.*' => 'nullable|array',
'menu_permissions.*.*' => 'in:view,create,update,delete,approve,export,manage',
];
}
@@ -46,8 +49,9 @@ public function attributes(): array
{
return [
'name' => '역할 이름',
'guard_name' => 'Guard',
'description' => '설명',
'permissions' => '권한',
'menu_permissions' => '메뉴 권한',
];
}
@@ -60,8 +64,9 @@ public function messages(): array
'name.required' => '역할 이름은 필수입니다.',
'name.unique' => '이미 존재하는 역할 이름입니다.',
'name.max' => '역할 이름은 최대 100자까지 입력 가능합니다.',
'guard_name.required' => 'Guard는 필수입니다.',
'guard_name.in' => 'Guard는 api 또는 web만 선택 가능합니다.',
'description.max' => '설명은 최대 500자까지 입력 가능합니다.',
'permissions.*.exists' => '유효하지 않은 권한이 포함되어 있습니다.',
];
}
}