v7.0.0-beta.4 release
This commit is contained in:
1 parent
05db17887d
commit
1db039ff34
1545 files changed
+136783
-11634
No files matched your search
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Identity;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use App\Models\IdentityMessageDefinition;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* IDV 메시지 정의 목록 조회 FormRequest.
|
||||
*/
|
||||
class AdminIdentityMessageDefinitionIndexRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 확인 (미들웨어에서 처리).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'search' => ['nullable', 'string', 'max:255'],
|
||||
'provider_id' => ['nullable', 'string', 'max:64'],
|
||||
'scope_type' => ['nullable', 'string', Rule::in([
|
||||
IdentityMessageDefinition::SCOPE_PROVIDER_DEFAULT,
|
||||
IdentityMessageDefinition::SCOPE_PURPOSE,
|
||||
IdentityMessageDefinition::SCOPE_POLICY,
|
||||
])],
|
||||
'scope_value' => ['nullable', 'string', 'max:120'],
|
||||
'extension_type' => ['nullable', 'string', Rule::in(['core', 'module', 'plugin'])],
|
||||
'extension_identifier' => ['nullable', 'string', 'max:100'],
|
||||
'channel' => ['nullable', 'string', 'max:20'],
|
||||
'is_active' => ['nullable', 'boolean'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'sort_by' => ['nullable', 'string', Rule::in([
|
||||
'id', 'provider_id', 'scope_type', 'scope_value', 'is_active', 'created_at', 'updated_at',
|
||||
])],
|
||||
'sort_order' => ['nullable', 'string', Rule::in(['asc', 'desc'])],
|
||||
];
|
||||
|
||||
return HookManager::applyFilters(
|
||||
'core.identity.message_definition.filter_index_rules',
|
||||
$rules
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 메시지.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'per_page.min' => __('validation.min.numeric', ['attribute' => 'per_page', 'min' => 1]),
|
||||
'per_page.max' => __('validation.max.numeric', ['attribute' => 'per_page', 'max' => 100]),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Identity;
|
||||
|
||||
use App\Models\IdentityMessageTemplate;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* IDV 메시지 템플릿 미리보기 FormRequest.
|
||||
*
|
||||
* 변수 치환 결과(subject/body)를 즉시 렌더링해 반환할 때 사용합니다.
|
||||
*/
|
||||
class PreviewIdentityMessageTemplateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 확인 (미들웨어에서 처리).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'template_id' => ['required', 'integer', Rule::exists(IdentityMessageTemplate::class, 'id')],
|
||||
'data' => ['sometimes', 'array'],
|
||||
'data.*' => ['nullable'],
|
||||
'locale' => ['sometimes', 'nullable', 'string', 'max:10'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Identity;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use App\Extension\IdentityVerification\IdentityVerificationManager;
|
||||
use App\Models\IdentityMessageDefinition;
|
||||
use App\Models\IdentityPolicy;
|
||||
use App\Rules\LocaleRequiredTranslatable;
|
||||
use App\Rules\TranslatableField;
|
||||
use Closure;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* 운영자가 정책 매핑 IDV 메시지 정의를 신규 생성할 때의 검증.
|
||||
*
|
||||
* 정책:
|
||||
* - scope_type 은 'policy' 만 허용 (provider_default/purpose 는 시드 영역).
|
||||
* - scope_value 는 source_type='admin' 인 IdentityPolicy.key 와 일치해야 함.
|
||||
* - (provider_id, scope_type, scope_value) 는 unique.
|
||||
* - 권한은 라우트 permission 미들웨어가 담당.
|
||||
*/
|
||||
class StoreIdentityMessageDefinitionRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'provider_id' => ['required', 'string', 'max:64', $this->providerExistsRule()],
|
||||
'scope_type' => ['required', Rule::in([IdentityMessageDefinition::SCOPE_POLICY])],
|
||||
'scope_value' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:120',
|
||||
$this->adminPolicyKeyRule(),
|
||||
$this->scopeUniqueRule(),
|
||||
],
|
||||
'name' => ['required', 'array', new LocaleRequiredTranslatable(maxLength: 200)],
|
||||
'description' => ['nullable', 'array', new TranslatableField(maxLength: 1000)],
|
||||
'channels' => ['required', 'array', 'min:1'],
|
||||
'channels.*' => ['string', Rule::in(['mail'])],
|
||||
'variables' => ['nullable', 'array'],
|
||||
'variables.*.key' => ['required_with:variables', 'string', 'max:64', 'regex:/^[a-z][a-z0-9_]*$/i'],
|
||||
'variables.*.description' => ['nullable', 'string', 'max:200'],
|
||||
'templates' => ['required', 'array', 'min:1'],
|
||||
'templates.*.channel' => ['required', 'string', 'max:20'],
|
||||
'templates.*.subject' => ['required', 'array', new LocaleRequiredTranslatable(maxLength: 500)],
|
||||
'templates.*.body' => ['required', 'array', new LocaleRequiredTranslatable(maxLength: 65535)],
|
||||
];
|
||||
|
||||
return HookManager::applyFilters(
|
||||
'core.identity.message_definition.filter_store_rules',
|
||||
$rules,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* provider_id 가 등록된 IDV 프로바이더인지 확인하는 closure 룰.
|
||||
*
|
||||
* @return Closure
|
||||
*/
|
||||
protected function providerExistsRule(): Closure
|
||||
{
|
||||
return function (string $attribute, mixed $value, Closure $fail): void {
|
||||
if (! is_string($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$manager = app(IdentityVerificationManager::class);
|
||||
if (! $manager->has($value)) {
|
||||
$fail(__('validation.identity_message.provider_not_registered'));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* scope_value 가 source_type='admin' 인 IdentityPolicy.key 와 일치하는지 확인.
|
||||
*
|
||||
* @return Closure
|
||||
*/
|
||||
protected function adminPolicyKeyRule(): Closure
|
||||
{
|
||||
return function (string $attribute, mixed $value, Closure $fail): void {
|
||||
if (! is_string($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$exists = IdentityPolicy::where('key', $value)
|
||||
->where('source_type', 'admin')
|
||||
->exists();
|
||||
|
||||
if (! $exists) {
|
||||
$fail(__('validation.identity_message.scope_value_not_admin_policy'));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* (provider_id, scope_type, scope_value) 조합 중복 검사.
|
||||
*
|
||||
* @return Closure
|
||||
*/
|
||||
protected function scopeUniqueRule(): Closure
|
||||
{
|
||||
return function (string $attribute, mixed $value, Closure $fail): void {
|
||||
$providerId = $this->input('provider_id');
|
||||
$scopeType = $this->input('scope_type');
|
||||
|
||||
if (! is_string($providerId) || ! is_string($scopeType) || ! is_string($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$exists = IdentityMessageDefinition::where('provider_id', $providerId)
|
||||
->where('scope_type', $scopeType)
|
||||
->where('scope_value', $value)
|
||||
->exists();
|
||||
|
||||
if ($exists) {
|
||||
$fail(__('validation.identity_message.definition_already_exists'));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Identity;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use App\Rules\LocaleRequiredTranslatable;
|
||||
use App\Rules\TranslatableField;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* IDV 메시지 정의 수정 FormRequest.
|
||||
*
|
||||
* 운영자 편집 가능 필드: name, description, channels, is_active.
|
||||
* provider_id/scope_type/scope_value 는 시스템 식별자라 편집 불가.
|
||||
*/
|
||||
class UpdateIdentityMessageDefinitionRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 확인 (미들웨어에서 처리).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => ['sometimes', 'array', new LocaleRequiredTranslatable(maxLength: 200)],
|
||||
'description' => ['sometimes', 'nullable', 'array', new TranslatableField(maxLength: 1000)],
|
||||
'channels' => ['sometimes', 'array', 'min:1'],
|
||||
'channels.*' => ['string', 'max:20'],
|
||||
'is_active' => ['sometimes', 'boolean'],
|
||||
];
|
||||
|
||||
return HookManager::applyFilters(
|
||||
'core.identity.message_definition.filter_update_rules',
|
||||
$rules,
|
||||
$this->route('definition')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Identity;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use App\Rules\LocaleRequiredTranslatable;
|
||||
use App\Rules\TranslatableField;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* IDV 메시지 템플릿 수정 FormRequest.
|
||||
*
|
||||
* 운영자 편집 가능 필드: subject(다국어), body(다국어 필수), is_active.
|
||||
* channel/definition_id 는 시스템 식별자라 편집 불가.
|
||||
*/
|
||||
class UpdateIdentityMessageTemplateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 확인 (미들웨어에서 처리).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'subject' => ['sometimes', 'nullable', 'array', new TranslatableField(maxLength: 500)],
|
||||
'body' => ['required', 'array', new LocaleRequiredTranslatable(maxLength: 65535)],
|
||||
'is_active' => ['sometimes', 'boolean'],
|
||||
];
|
||||
|
||||
return HookManager::applyFilters(
|
||||
'core.identity.message_template.filter_update_rules',
|
||||
$rules,
|
||||
$this->route('template')
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Extension;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 자동 비활성화된 확장 목록 조회 요청 (입력 없음 — placeholder).
|
||||
*
|
||||
* @since 7.0.0-beta.4
|
||||
*/
|
||||
class AutoDeactivatedListRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 입력 없음 (전체 목록 반환).
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Extension;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 호환성 알림 dismiss 요청 (입력 없음 — type/identifier 는 라우트 파라미터).
|
||||
*
|
||||
* @since 7.0.0-beta.4
|
||||
*/
|
||||
class DismissAlertRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 입력 없음 (라우트 파라미터로 type/identifier 전달).
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Extension;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 비호환 자동 비활성화 확장 원클릭 복구 요청 (입력 없음 — type/identifier 는 라우트 파라미터).
|
||||
*
|
||||
* @since 7.0.0-beta.4
|
||||
*/
|
||||
class RecoverRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 입력 없음 (라우트 파라미터로 type/identifier 전달).
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use App\Enums\IdentityOriginType;
|
||||
use App\Enums\IdentityPolicySourceType;
|
||||
use App\Enums\IdentityVerificationStatus;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* 관리자 IDV 이력 목록 조회 검증.
|
||||
*
|
||||
* S2 관리자 인증 이력 목록의 필터 쿼리 파라미터를 화이트리스트로 제한합니다.
|
||||
*/
|
||||
class AdminIdentityLogIndexRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
// 단일값 호환 — 외부 링크/북마크 (?status=verified) 회귀 차단
|
||||
'provider_id' => ['nullable', 'string', 'max:64'],
|
||||
'purpose' => ['nullable', 'string', 'max:64'],
|
||||
'status' => ['nullable', Rule::enum(IdentityVerificationStatus::class)],
|
||||
'channel' => ['nullable', 'string', 'max:16'],
|
||||
'origin_type' => ['nullable', Rule::enum(IdentityOriginType::class)],
|
||||
'source_type' => ['nullable', Rule::enum(IdentityPolicySourceType::class)],
|
||||
'source_identifier' => ['nullable', 'string', 'max:100'],
|
||||
|
||||
// 다중값 array — 신규 다중선택 필터
|
||||
'provider_ids' => ['nullable', 'array'],
|
||||
'provider_ids.*' => ['string', 'max:64'],
|
||||
'purposes' => ['nullable', 'array'],
|
||||
'purposes.*' => ['string', 'max:64'],
|
||||
'statuses' => ['nullable', 'array'],
|
||||
'statuses.*' => [Rule::enum(IdentityVerificationStatus::class)],
|
||||
'channels' => ['nullable', 'array'],
|
||||
'channels.*' => ['string', 'max:16'],
|
||||
'origin_types' => ['nullable', 'array'],
|
||||
'origin_types.*' => [Rule::enum(IdentityOriginType::class)],
|
||||
|
||||
// 감사 로그 — 삭제된 user_id 도 조회 가능해야 하므로 exists 검증 사용 안 함.
|
||||
'user_id' => ['nullable', 'integer', 'min:1'],
|
||||
'target_hash' => ['nullable', 'string', 'size:64'],
|
||||
'search' => ['nullable', 'string', 'max:64'],
|
||||
'search_type' => ['nullable', 'string', 'in:auto,user_id,target_hash,ip_address,policy_key'],
|
||||
'sort_by' => ['nullable', 'string', 'in:created_at,attempts'],
|
||||
'sort_order' => ['nullable', 'string', 'in:asc,desc'],
|
||||
'date_from' => ['nullable', 'date'],
|
||||
'date_to' => ['nullable', 'date', 'after_or_equal:date_from'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 관리자 IDV 이력 파기 검증.
|
||||
*
|
||||
* older_than_days 파라미터의 범위를 제한합니다.
|
||||
*/
|
||||
class AdminIdentityLogPurgeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'older_than_days' => ['nullable', 'integer', 'min:1', 'max:3650'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* 관리자 정책 목록 조회 검증.
|
||||
*
|
||||
* S1d DataGrid 의 필터 쿼리 파라미터를 화이트리스트로 제한합니다.
|
||||
*/
|
||||
class AdminIdentityPolicyIndexRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'scope' => ['nullable', Rule::in(['route', 'hook', 'custom'])],
|
||||
'purpose' => ['nullable', 'string', 'max:64'],
|
||||
'source_type' => ['nullable', Rule::in(['core', 'module', 'plugin', 'admin'])],
|
||||
'source_identifier' => ['nullable', 'string', 'max:100'],
|
||||
'applies_to' => ['nullable', Rule::in(['self', 'admin', 'both'])],
|
||||
'fail_mode' => ['nullable', Rule::in(['block', 'log_only'])],
|
||||
'enabled' => ['nullable', 'boolean'],
|
||||
'search' => ['nullable', 'string', 'max:255'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* S1d "↺ 기본값으로 되돌리기" 요청 검증.
|
||||
*
|
||||
* 관리자가 특정 필드의 user_overrides 를 해제하고 선언 기본값으로 복원할 때 사용됩니다.
|
||||
* 인증/권한은 라우트의 permission 미들웨어 체인이 담당합니다.
|
||||
*/
|
||||
class AdminIdentityPolicyResetFieldRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 인증/권한은 route middleware 가 담당 — FormRequest 는 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙.
|
||||
*
|
||||
* @return array<string, array<int, string>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'field' => ['required', 'string', 'in:enabled,grace_minutes,provider_id,fail_mode,conditions'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use App\Enums\IdentityPolicyAppliesTo;
|
||||
use App\Enums\IdentityPolicyFailMode;
|
||||
use App\Enums\IdentityPolicyScope;
|
||||
use App\Models\IdentityPolicy;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* 운영자가 신규 IDV 정책을 생성할 때의 검증.
|
||||
*
|
||||
* 권한은 라우트의 permission:admin,core.admin.identity.policies.manage 미들웨어가 담당.
|
||||
*/
|
||||
class AdminIdentityPolicyStoreRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'key' => ['required', 'string', 'max:120', Rule::unique(IdentityPolicy::class, 'key')],
|
||||
'scope' => ['required', Rule::enum(IdentityPolicyScope::class)],
|
||||
'target' => ['required', 'string', 'max:255'],
|
||||
'purpose' => ['required', 'string', 'max:64'],
|
||||
'provider_id' => ['nullable', 'string', 'max:64'],
|
||||
'grace_minutes' => ['required', 'integer', 'min:0', 'max:43200'],
|
||||
'enabled' => ['boolean'],
|
||||
'priority' => ['integer', 'min:0', 'max:65535'],
|
||||
'conditions' => ['nullable', 'array'],
|
||||
'applies_to' => ['required', Rule::enum(IdentityPolicyAppliesTo::class)],
|
||||
'fail_mode' => ['required', Rule::enum(IdentityPolicyFailMode::class)],
|
||||
// source_identifier — 운영자 자유 정책의 컨텍스트 귀속.
|
||||
// 'admin' (기본, 어느 확장에도 귀속 안 됨) | 'core' | 모듈/플러그인 raw identifier (예: 'sirsoft-ecommerce').
|
||||
// 모듈/플러그인 sync 경로 및 목록 필터가 모두 raw identifier 컨벤션을 사용하므로 동일하게 통일.
|
||||
'source_identifier' => ['nullable', 'string', 'max:100', 'regex:/^[a-z][a-z0-9_\-]*$/'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 정의 검증 메시지.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'key.required' => __('validation.identity_policy.key_required'),
|
||||
'key.max' => __('validation.identity_policy.key_max'),
|
||||
'key.unique' => __('validation.identity_policy.key_unique'),
|
||||
'scope.required' => __('validation.identity_policy.scope_required'),
|
||||
'scope.enum' => __('validation.identity_policy.scope_invalid'),
|
||||
'target.required' => __('validation.identity_policy.target_required'),
|
||||
'target.max' => __('validation.identity_policy.target_max'),
|
||||
'purpose.required' => __('validation.identity_policy.purpose_required'),
|
||||
'purpose.max' => __('validation.identity_policy.purpose_max'),
|
||||
'provider_id.max' => __('validation.identity_policy.provider_id_max'),
|
||||
'grace_minutes.required' => __('validation.identity_policy.grace_minutes_required'),
|
||||
'grace_minutes.integer' => __('validation.identity_policy.grace_minutes_integer'),
|
||||
'grace_minutes.min' => __('validation.identity_policy.grace_minutes_min'),
|
||||
'grace_minutes.max' => __('validation.identity_policy.grace_minutes_max'),
|
||||
'enabled.boolean' => __('validation.identity_policy.enabled_boolean'),
|
||||
'priority.integer' => __('validation.identity_policy.priority_integer'),
|
||||
'priority.min' => __('validation.identity_policy.priority_min'),
|
||||
'priority.max' => __('validation.identity_policy.priority_max'),
|
||||
'conditions.array' => __('validation.identity_policy.conditions_array'),
|
||||
'applies_to.required' => __('validation.identity_policy.applies_to_required'),
|
||||
'applies_to.enum' => __('validation.identity_policy.applies_to_invalid'),
|
||||
'fail_mode.required' => __('validation.identity_policy.fail_mode_required'),
|
||||
'fail_mode.enum' => __('validation.identity_policy.fail_mode_invalid'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 속성명 (validation.attributes).
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'key' => __('validation.attributes.identity_policy_key'),
|
||||
'scope' => __('validation.attributes.identity_policy_scope'),
|
||||
'target' => __('validation.attributes.identity_policy_target'),
|
||||
'purpose' => __('validation.attributes.identity_policy_purpose'),
|
||||
'provider_id' => __('validation.attributes.identity_policy_provider_id'),
|
||||
'grace_minutes' => __('validation.attributes.identity_policy_grace_minutes'),
|
||||
'enabled' => __('validation.attributes.identity_policy_enabled'),
|
||||
'applies_to' => __('validation.attributes.identity_policy_applies_to'),
|
||||
'fail_mode' => __('validation.attributes.identity_policy_fail_mode'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use App\Enums\IdentityPolicyAppliesTo;
|
||||
use App\Enums\IdentityPolicyFailMode;
|
||||
use App\Enums\IdentityPolicyScope;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* 운영자가 IDV 정책을 수정할 때의 검증.
|
||||
*
|
||||
* source_type != 'admin' 정책은 enabled/grace_minutes/provider_id/fail_mode 4개 필드만 허용됩니다.
|
||||
* (key/scope/target/conditions 등은 readonly — 선언형 Seeder 의 SSoT 유지를 위해 Controller 에서 필터링)
|
||||
*/
|
||||
class AdminIdentityPolicyUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'enabled' => ['sometimes', 'boolean'],
|
||||
'grace_minutes' => ['sometimes', 'integer', 'min:0', 'max:43200'],
|
||||
'provider_id' => ['sometimes', 'nullable', 'string', 'max:64'],
|
||||
'fail_mode' => ['sometimes', Rule::enum(IdentityPolicyFailMode::class)],
|
||||
|
||||
// 아래 필드는 source_type=admin 일 때만 Controller 에서 적용
|
||||
'key' => ['sometimes', 'string', 'max:120'],
|
||||
'scope' => ['sometimes', Rule::enum(IdentityPolicyScope::class)],
|
||||
'target' => ['sometimes', 'string', 'max:255'],
|
||||
'purpose' => ['sometimes', 'string', 'max:64'],
|
||||
'priority' => ['sometimes', 'integer', 'min:0', 'max:65535'],
|
||||
'conditions' => ['sometimes', 'nullable', 'array'],
|
||||
'applies_to' => ['sometimes', Rule::enum(IdentityPolicyAppliesTo::class)],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 정의 검증 메시지.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'key.max' => __('validation.identity_policy.key_max'),
|
||||
'scope.enum' => __('validation.identity_policy.scope_invalid'),
|
||||
'target.max' => __('validation.identity_policy.target_max'),
|
||||
'purpose.max' => __('validation.identity_policy.purpose_max'),
|
||||
'provider_id.max' => __('validation.identity_policy.provider_id_max'),
|
||||
'grace_minutes.integer' => __('validation.identity_policy.grace_minutes_integer'),
|
||||
'grace_minutes.min' => __('validation.identity_policy.grace_minutes_min'),
|
||||
'grace_minutes.max' => __('validation.identity_policy.grace_minutes_max'),
|
||||
'enabled.boolean' => __('validation.identity_policy.enabled_boolean'),
|
||||
'priority.integer' => __('validation.identity_policy.priority_integer'),
|
||||
'priority.min' => __('validation.identity_policy.priority_min'),
|
||||
'priority.max' => __('validation.identity_policy.priority_max'),
|
||||
'conditions.array' => __('validation.identity_policy.conditions_array'),
|
||||
'applies_to.enum' => __('validation.identity_policy.applies_to_invalid'),
|
||||
'fail_mode.enum' => __('validation.identity_policy.fail_mode_invalid'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 속성명 (validation.attributes).
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'key' => __('validation.attributes.identity_policy_key'),
|
||||
'scope' => __('validation.attributes.identity_policy_scope'),
|
||||
'target' => __('validation.attributes.identity_policy_target'),
|
||||
'purpose' => __('validation.attributes.identity_policy_purpose'),
|
||||
'provider_id' => __('validation.attributes.identity_policy_provider_id'),
|
||||
'grace_minutes' => __('validation.attributes.identity_policy_grace_minutes'),
|
||||
'enabled' => __('validation.attributes.identity_policy_enabled'),
|
||||
'applies_to' => __('validation.attributes.identity_policy_applies_to'),
|
||||
'fail_mode' => __('validation.attributes.identity_policy_fail_mode'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Challenge 취소 요청.
|
||||
*
|
||||
* 권한은 라우트의 permission:user,core.identity.cancel 미들웨어가 담당합니다.
|
||||
* 로그인 사용자는 PermissionMiddleware 의 scope=self 가드가 challenge.user_id 일치를 자동 검증합니다.
|
||||
* 비로그인 게스트는 guest 역할 권한만 통과하면 진입합니다 (모달 취소 시 audit trail 정합용).
|
||||
*
|
||||
* 검증 규칙은 비어 있습니다 — 라우트 모델 바인딩이 challenge UUID 유효성을 보장하므로 추가 입력 검증 불필요.
|
||||
*/
|
||||
class CancelChallengeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 외부 IDV provider 의 redirect 콜백 수신 요청.
|
||||
*
|
||||
* `POST /api/identity/callback/{providerId}` — 외부 본인인증 SDK / OAuth-style
|
||||
* provider 가 사용자 브라우저를 우리 서버로 다시 보내는 콜백 진입점.
|
||||
*
|
||||
* 요청 형식 예시:
|
||||
* - PortOne 스타일: body 에 `{ challenge_id, identity_verification_id, ... }`
|
||||
* - OAuth 스타일: query 에 `?challenge_id=...&code=...&state=...`
|
||||
*
|
||||
* 본 FormRequest 는 challenge_id 추출 + 자유로운 provider 페이로드 통과만 검증합니다.
|
||||
* 실제 provider 별 페이로드 해석은 IdentityVerificationManager 가 provider 의
|
||||
* `verify($challengeId, $input, $context)` 에 위임합니다.
|
||||
*
|
||||
* @since engine-v1.46.0
|
||||
*/
|
||||
class IdentityCallbackRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 외부 redirect 콜백은 라우트 미들웨어 (throttle/optional.sanctum) 가 담당.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙.
|
||||
*
|
||||
* challenge_id 는 body 또는 query 둘 중 하나에 반드시 포함되어야 합니다.
|
||||
* 그 외 provider 별 필드는 자유 통과 (provider->verify 내부에서 추가 검증).
|
||||
*
|
||||
* @return array<string, array<int, string>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'challenge_id' => ['required', 'string', 'max:64'],
|
||||
// 일반적으로 사용되는 필드 — 명시적으로 nullable 로 허용해 검증 통과
|
||||
'code' => ['nullable', 'string', 'max:512'],
|
||||
'token' => ['nullable', 'string', 'max:1024'],
|
||||
'state' => ['nullable', 'string', 'max:512'],
|
||||
'redirect_url' => ['nullable', 'string', 'max:2048'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* body / query 양쪽에서 challenge_id 를 합쳐 검증 대상에 포함시킵니다.
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
if (! $this->filled('challenge_id') && $this->query('challenge_id')) {
|
||||
$this->merge(['challenge_id' => (string) $this->query('challenge_id')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 등록된 IDV 프로바이더 목록 조회 요청 (GET /api/identity/providers).
|
||||
*
|
||||
* 공개 메타데이터만 노출 — 인증/권한 가드 없음.
|
||||
*/
|
||||
class ProvidersIndexRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 공개 엔드포인트.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 등록된 IDV purpose 목록 조회 요청 (GET /api/identity/purposes).
|
||||
*
|
||||
* 코어 4종 + 활성 모듈/플러그인 declarative purpose + filter 훅 확장 결과를 반환.
|
||||
*/
|
||||
class PurposesIndexRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 공개 엔드포인트.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Challenge 요청 검증.
|
||||
*
|
||||
* 권한은 라우트의 permission:user,core.identity.request 미들웨어가 담당합니다.
|
||||
* 비로그인 가입 플로우(Mode B) 도 동일 엔드포인트를 사용하므로 optional.sanctum 경로도 허용.
|
||||
*/
|
||||
class RequestChallengeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'purpose' => ['required', 'string', 'max:64'],
|
||||
'target' => ['nullable', 'array'],
|
||||
'target.email' => ['nullable', 'email', 'max:255'],
|
||||
'target.phone' => ['nullable', 'string', 'max:32'],
|
||||
'provider_id' => ['nullable', 'string', 'max:64'],
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 IDV challenge 요청 검증 규칙을 동적으로 확장 가능 (예: 도메인 특화 메타데이터)
|
||||
return HookManager::applyFilters('core.identity.request_validation_rules', $rules, $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* IDV 정책 해석 요청 (GET /api/identity/policies/resolve?scope=route&target=...).
|
||||
*
|
||||
* 프론트엔드 프리페치용 — 레이아웃 마운트 시 이 페이지에서 IDV 가 요구될 수 있는 API 를 미리 파악하기 위한 엔드포인트.
|
||||
*/
|
||||
class ResolvePolicyRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — optional.sanctum 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'scope' => ['required', 'string', 'max:32'],
|
||||
'target' => ['required', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Challenge 폴링 요청 (GET /api/identity/challenges/{challenge}).
|
||||
*
|
||||
* 비동기 검증 흐름(Stripe Identity / 외부 redirect 콜백 대기) 에서 클라이언트가 상태를 추적하기 위한 엔드포인트의 입력 컨테이너.
|
||||
* 권한 가드 없이 optional.sanctum + throttle 만 적용 — 노출 필드는 공개 안전 항목만.
|
||||
*/
|
||||
class ShowChallengeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 폴링 엔드포인트는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Identity;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Challenge 검증 요청.
|
||||
*
|
||||
* 권한은 라우트의 permission:user,core.identity.verify 미들웨어가 담당합니다.
|
||||
* 로그인 사용자는 PermissionMiddleware 의 scope=self 가드가 challenge.user_id 일치를 자동 검증합니다.
|
||||
* 비로그인 가입 플로우(Mode B) 도 동일 엔드포인트를 사용하므로 optional.sanctum 경로도 허용.
|
||||
*/
|
||||
class VerifyChallengeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 요청 권한 — 라우트 permission 미들웨어가 담당하므로 true 고정.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 반환합니다.
|
||||
*
|
||||
* @return array<string, array<int, mixed>> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'code' => ['nullable', 'string', 'max:16'],
|
||||
'token' => ['nullable', 'string', 'max:256'],
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 IDV challenge 검증 입력 규칙을 동적으로 확장 가능 (예: 외부 provider SDK payload 필드)
|
||||
return HookManager::applyFilters('core.identity.verify_validation_rules', $rules, $this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use App\Models\LanguagePack;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* 언어팩 일괄 활성화 요청 (PO #7 reactivate 모달 → "활성화" 버튼).
|
||||
*
|
||||
* 호스트 확장 재활성화 시 cascade 비활성화됐던 언어팩 ID 배열을 받아
|
||||
* Service 의 bulkActivate() 로 위임합니다.
|
||||
*/
|
||||
class BulkActivateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'ids' => ['required', 'array', 'min:1'],
|
||||
'ids.*' => ['required', 'integer', Rule::exists(LanguagePack::class, 'id')],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use App\Enums\LanguagePackScope;
|
||||
use App\Enums\LanguagePackStatus;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* 언어팩 목록 조회 요청 (필터/페이지네이션).
|
||||
*/
|
||||
class IndexLanguagePackRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당하므로 항상 true 반환.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'scope' => ['nullable', 'string', Rule::in(LanguagePackScope::values())],
|
||||
'target_identifier' => ['nullable', 'string', 'max:150'],
|
||||
'locale' => ['nullable', 'string', 'max:20'],
|
||||
'status' => ['nullable', 'string', Rule::in(LanguagePackStatus::values())],
|
||||
'vendor' => ['nullable', 'string', 'max:100'],
|
||||
'search' => ['nullable', 'string', 'max:150'],
|
||||
'exclude_protected' => ['nullable', 'boolean'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 번들(`lang-packs/_bundled/{identifier}`) 디렉토리에서 언어팩 설치 요청.
|
||||
*
|
||||
* 코어/공식 번들 언어팩을 외부 다운로드 없이 로컬 번들에서 (재)설치하는 경로.
|
||||
* 모듈/플러그인/템플릿의 `_bundled` 설치 패턴과 동일.
|
||||
*/
|
||||
class InstallFromBundledRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'identifier' => [
|
||||
'required',
|
||||
'string',
|
||||
'max:200',
|
||||
'regex:/^[a-zA-Z0-9._\-]+$/',
|
||||
],
|
||||
'auto_activate' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 메시지를 정의합니다.
|
||||
*
|
||||
* @return array<string, string> 검증 메시지
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'identifier.required' => __('language_packs.validation.identifier_required'),
|
||||
'identifier.regex' => __('language_packs.validation.identifier_invalid'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* ZIP 파일 업로드를 통한 언어팩 설치 요청.
|
||||
*/
|
||||
class InstallFromFileRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'file' => ['required', 'file', 'max:10240', 'mimetypes:application/zip,application/x-zip-compressed,application/octet-stream'],
|
||||
'auto_activate' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 메시지를 정의합니다.
|
||||
*
|
||||
* @return array<string, string> 검증 메시지
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'file.required' => __('language_packs.validation.file_required'),
|
||||
'file.file' => __('language_packs.validation.file_invalid'),
|
||||
'file.max' => __('language_packs.validation.file_too_large'),
|
||||
'file.mimetypes' => __('language_packs.validation.file_not_zip'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* GitHub URL 을 통한 언어팩 설치 요청.
|
||||
*/
|
||||
class InstallFromGithubRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'github_url' => [
|
||||
'required',
|
||||
'url',
|
||||
'regex:/^https?:\/\/(www\.)?github\.com\/[a-zA-Z0-9\-_]+\/[a-zA-Z0-9\-_]+\/?$/',
|
||||
],
|
||||
'auto_activate' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 메시지를 정의합니다.
|
||||
*
|
||||
* @return array<string, string> 검증 메시지
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'github_url.required' => __('language_packs.validation.github_url_required'),
|
||||
'github_url.url' => __('language_packs.validation.github_url_invalid'),
|
||||
'github_url.regex' => __('language_packs.validation.github_url_format'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 임의 URL 을 통한 언어팩 설치 요청.
|
||||
*/
|
||||
class InstallFromUrlRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'url' => ['required', 'url', 'max:500'],
|
||||
'checksum' => ['nullable', 'string', 'regex:/^[a-f0-9]{64}$/i'],
|
||||
'auto_activate' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 메시지를 정의합니다.
|
||||
*
|
||||
* @return array<string, string> 검증 메시지
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'url.required' => __('language_packs.validation.url_required'),
|
||||
'url.url' => __('language_packs.validation.url_invalid'),
|
||||
'checksum.regex' => __('language_packs.validation.checksum_invalid'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 언어팩 manifest 미리보기 요청.
|
||||
*
|
||||
* 설치 전 ZIP 의 manifest 와 검증 결과만 추출하여 반환합니다 (실제 설치 X).
|
||||
*/
|
||||
class ManifestPreviewRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'file' => ['required', 'file', 'mimes:zip', 'max:5120'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\LanguagePack;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 언어팩 제거 요청.
|
||||
*
|
||||
* cascade=true 인 경우 코어 언어팩 제거 시 동일 locale 의 하위(module/plugin/template)
|
||||
* 언어팩도 비활성화 처리됩니다.
|
||||
*/
|
||||
class UninstallLanguagePackRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'cascade' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,9 @@ class IndexModuleRequest extends FormRequest
|
||||
// 페이지네이션
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
|
||||
// 숨김 항목 포함 여부 (manifest hidden=true 확장)
|
||||
'include_hidden' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
|
||||
@@ -10,6 +10,11 @@ class InstallModuleRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* 권한 검사는 라우트 미들웨어 (`permission:modules.install`) 가 담당하므로
|
||||
* FormRequest 레벨은 항상 통과시킵니다.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
@@ -26,6 +31,12 @@ class InstallModuleRequest extends FormRequest
|
||||
$rules = [
|
||||
'module_name' => ['required', 'string', 'max:255', new ValidExtensionIdentifier],
|
||||
'vendor_mode' => ['nullable', 'string', 'in:auto,composer,bundled'],
|
||||
// cascade 동반 설치 — install-preview 응답을 바탕으로 사용자가 선택한 항목
|
||||
'dependencies' => ['nullable', 'array'],
|
||||
'dependencies.*.type' => ['required_with:dependencies', 'string', 'in:module,plugin'],
|
||||
'dependencies.*.identifier' => ['required_with:dependencies', 'string', 'max:255'],
|
||||
'language_packs' => ['nullable', 'array'],
|
||||
'language_packs.*' => ['string', 'max:255'],
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
|
||||
@@ -17,6 +17,8 @@ class PerformModuleUpdateRequest extends FormRequest
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*
|
||||
* @return bool 항상 true (권한은 미들웨어 체인에서 검증)
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
@@ -33,9 +35,11 @@ class PerformModuleUpdateRequest extends FormRequest
|
||||
$rules = [
|
||||
'layout_strategy' => ['nullable', 'string', 'in:overwrite,keep'],
|
||||
'vendor_mode' => ['nullable', 'string', 'in:auto,composer,bundled'],
|
||||
// 코어 버전 비호환 강제 우회 플래그
|
||||
'force' => ['nullable', 'boolean'],
|
||||
];
|
||||
|
||||
return HookManager::applyFilters('core.module.perform_update_rules', $rules);
|
||||
return HookManager::applyFilters('core.module.perform_update_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Module;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 모듈 manifest 미리보기 요청.
|
||||
*
|
||||
* 설치 전 ZIP 의 module.json 과 검증 결과만 추출하여 반환합니다 (실제 설치 X).
|
||||
*/
|
||||
class PreviewModuleManifestRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$maxSize = config('module.upload_max_size', 50) * 1024;
|
||||
|
||||
return [
|
||||
'file' => ['required', 'file', 'mimes:zip', 'max:'.$maxSize],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 실패 메시지.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
$maxSize = config('module.upload_max_size', 50);
|
||||
|
||||
return [
|
||||
'file.required' => __('modules.validation.file_required'),
|
||||
'file.file' => __('modules.validation.file_invalid'),
|
||||
'file.mimes' => __('modules.validation.file_must_be_zip'),
|
||||
'file.max' => __('modules.validation.file_max_size', ['size' => $maxSize]),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,9 @@ class IndexPluginRequest extends FormRequest
|
||||
// 페이지네이션
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
|
||||
// 숨김 항목 포함 여부 (manifest hidden=true 확장)
|
||||
'include_hidden' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
|
||||
@@ -14,9 +14,12 @@ use Illuminate\Foundation\Http\FormRequest;
|
||||
class InstallPluginRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인합니다.
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행되므로
|
||||
* FormRequest 레벨은 항상 통과시킵니다.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
@@ -33,6 +36,12 @@ class InstallPluginRequest extends FormRequest
|
||||
$rules = [
|
||||
'plugin_name' => ['required', 'string', 'max:255', new ValidExtensionIdentifier],
|
||||
'vendor_mode' => ['nullable', 'string', 'in:auto,composer,bundled'],
|
||||
// cascade 동반 설치 — install-preview 응답을 바탕으로 사용자가 선택한 항목
|
||||
'dependencies' => ['nullable', 'array'],
|
||||
'dependencies.*.type' => ['required_with:dependencies', 'string', 'in:module,plugin'],
|
||||
'dependencies.*.identifier' => ['required_with:dependencies', 'string', 'max:255'],
|
||||
'language_packs' => ['nullable', 'array'],
|
||||
'language_packs.*' => ['string', 'max:255'],
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
|
||||
@@ -17,6 +17,8 @@ class PerformPluginUpdateRequest extends FormRequest
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*
|
||||
* @return bool 항상 true (권한은 미들웨어 체인에서 검증)
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
@@ -33,9 +35,11 @@ class PerformPluginUpdateRequest extends FormRequest
|
||||
$rules = [
|
||||
'layout_strategy' => ['nullable', 'string', 'in:overwrite,keep'],
|
||||
'vendor_mode' => ['nullable', 'string', 'in:auto,composer,bundled'],
|
||||
// 코어 버전 비호환 강제 우회 플래그 (위험 인지 후 사용자 명시 필요)
|
||||
'force' => ['nullable', 'boolean'],
|
||||
];
|
||||
|
||||
return HookManager::applyFilters('core.plugin.perform_update_rules', $rules);
|
||||
return HookManager::applyFilters('core.plugin.perform_update_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Plugin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 플러그인 manifest 미리보기 요청.
|
||||
*
|
||||
* 설치 전 ZIP 의 plugin.json 과 검증 결과만 추출하여 반환합니다 (실제 설치 X).
|
||||
*/
|
||||
class PreviewPluginManifestRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$maxSize = config('plugin.upload_max_size', 50) * 1024;
|
||||
|
||||
return [
|
||||
'file' => ['required', 'file', 'mimes:zip', 'max:'.$maxSize],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 실패 메시지.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
$maxSize = config('plugin.upload_max_size', 50);
|
||||
|
||||
return [
|
||||
'file.required' => __('plugins.validation.file_required'),
|
||||
'file.file' => __('plugins.validation.file_invalid'),
|
||||
'file.mimes' => __('plugins.validation.file_must_be_zip'),
|
||||
'file.max' => __('plugins.validation.file_max_size', ['size' => $maxSize]),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,6 @@ use Illuminate\Validation\Rule;
|
||||
|
||||
class SaveSettingsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 지원되는 언어 목록
|
||||
*/
|
||||
private const SUPPORTED_LANGUAGES = ['ko', 'en'];
|
||||
|
||||
/**
|
||||
* 지원되는 메일러 목록
|
||||
*/
|
||||
@@ -73,6 +68,8 @@ class SaveSettingsRequest extends FormRequest
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
@@ -150,7 +147,7 @@ class SaveSettingsRequest extends FormRequest
|
||||
|
||||
$rules = [
|
||||
// 탭 식별자
|
||||
'_tab' => ['nullable', 'string', Rule::in(['general', 'mail', 'upload', 'seo', 'security', 'drivers', 'advanced', 'notifications'])],
|
||||
'_tab' => ['nullable', 'string', Rule::in(['general', 'mail', 'upload', 'seo', 'security', 'drivers', 'advanced', 'notifications', 'identity'])],
|
||||
|
||||
// 각 탭의 컨테이너
|
||||
'general' => ['sometimes', 'array'],
|
||||
@@ -161,6 +158,7 @@ class SaveSettingsRequest extends FormRequest
|
||||
'drivers' => ['sometimes', 'array'],
|
||||
'advanced' => ['sometimes', 'array'],
|
||||
'notifications' => ['sometimes', 'array'],
|
||||
'identity' => ['sometimes', 'array'],
|
||||
'notifications.channels' => ['sometimes', 'array'],
|
||||
'notifications.channels.*.id' => ['required_with:notifications.channels', 'string', 'max:50'],
|
||||
'notifications.channels.*.is_active' => ['required_with:notifications.channels', 'boolean'],
|
||||
@@ -172,7 +170,7 @@ class SaveSettingsRequest extends FormRequest
|
||||
'general.site_description' => ['nullable', 'string', 'max:500'],
|
||||
'general.admin_email' => $this->getTabRules($tab, 'general', 'email|max:255'),
|
||||
'general.timezone' => $this->getTabRules($tab, 'general', ['timezone']),
|
||||
'general.language' => $this->getTabRules($tab, 'general', [Rule::in(self::SUPPORTED_LANGUAGES)]),
|
||||
'general.language' => $this->getTabRules($tab, 'general', [Rule::in(config('app.supported_locales', ['ko', 'en']))]),
|
||||
'general.currency' => ['nullable', 'string', 'max:10'],
|
||||
'general.maintenance_mode' => ['nullable', 'boolean'],
|
||||
'general.site_logo' => ['nullable', 'array'],
|
||||
@@ -211,12 +209,20 @@ class SaveSettingsRequest extends FormRequest
|
||||
'seo.bot_user_agents' => ['nullable', 'array'],
|
||||
'seo.bot_user_agents.*' => ['string', 'max:100'],
|
||||
'seo.bot_detection_enabled' => ['nullable', 'boolean'],
|
||||
'seo.bot_detection_library_enabled' => ['nullable', 'boolean'],
|
||||
'seo.og_default_site_name' => ['nullable', 'string', 'max:200'],
|
||||
'seo.og_image_default_width' => ['nullable', 'integer', 'min:0', 'max:8000'],
|
||||
'seo.og_image_default_height' => ['nullable', 'integer', 'min:0', 'max:8000'],
|
||||
'seo.twitter_default_card' => ['nullable', 'string', Rule::in(['summary', 'summary_large_image', 'app', 'player', ''])],
|
||||
'seo.twitter_default_site' => ['nullable', 'string', 'max:50'],
|
||||
'seo.cache_enabled' => ['nullable', 'boolean'],
|
||||
'seo.cache_ttl' => ['nullable', 'integer', 'min:60', 'max:86400'],
|
||||
'seo.sitemap_enabled' => ['nullable', 'boolean'],
|
||||
'seo.sitemap_cache_ttl' => ['nullable', 'integer', 'min:3600', 'max:604800'],
|
||||
'seo.sitemap_schedule' => ['nullable', 'string', Rule::in(['hourly', 'daily', 'weekly'])],
|
||||
'seo.sitemap_schedule_time' => ['nullable', 'string', 'regex:/^\d{2}:\d{2}$/'],
|
||||
'seo.generator_enabled' => ['nullable', 'boolean'],
|
||||
'seo.generator_content' => ['nullable', 'string', 'max:200'],
|
||||
|
||||
// 보안 설정
|
||||
'security.force_https' => $this->getTabRules($tab, 'security', 'boolean'),
|
||||
@@ -281,6 +287,13 @@ class SaveSettingsRequest extends FormRequest
|
||||
'drivers.log_driver' => $this->getTabRules($tab, 'drivers', [Rule::in(self::SUPPORTED_LOG_DRIVERS)]),
|
||||
'drivers.log_level' => $this->getTabRules($tab, 'drivers', [Rule::in(self::SUPPORTED_LOG_LEVELS)]),
|
||||
'drivers.log_days' => ['nullable', 'integer', 'min:1', 'max:365'],
|
||||
|
||||
// 본인인증(IDV) provider 기술 파라미터 — 정책 분기는 IdentityPolicy 로 흡수됨
|
||||
'identity.default_provider' => ['nullable', 'string', 'max:100'],
|
||||
'identity.purpose_providers' => ['sometimes', 'array'],
|
||||
'identity.purpose_providers.*' => ['nullable', 'string', 'max:100'],
|
||||
'identity.challenge_ttl_minutes' => $this->getTabRules($tab, 'identity', 'integer|min:1|max:1440'),
|
||||
'identity.max_attempts' => $this->getTabRules($tab, 'identity', 'integer|min:1|max:20'),
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
@@ -495,10 +508,26 @@ class SaveSettingsRequest extends FormRequest
|
||||
'seo.google_analytics_id.max' => __('validation.settings.google_analytics_id_max'),
|
||||
'seo.google_site_verification.max' => __('validation.settings.google_site_verification_max'),
|
||||
'seo.naver_site_verification.max' => __('validation.settings.naver_site_verification_max'),
|
||||
'seo.generator_enabled.boolean' => __('validation.settings.generator_enabled_boolean'),
|
||||
'seo.generator_content.string' => __('validation.settings.generator_content_string'),
|
||||
'seo.generator_content.max' => __('validation.settings.generator_content_max'),
|
||||
'seo.bot_user_agents.array' => __('validation.settings.bot_user_agents_array'),
|
||||
'seo.bot_user_agents.*.string' => __('validation.settings.bot_user_agents_item_string'),
|
||||
'seo.bot_user_agents.*.max' => __('validation.settings.bot_user_agents_item_max'),
|
||||
'seo.bot_detection_enabled.boolean' => __('validation.settings.bot_detection_enabled_boolean'),
|
||||
'seo.bot_detection_library_enabled.boolean' => __('validation.settings.bot_detection_library_enabled_boolean'),
|
||||
'seo.og_default_site_name.string' => __('validation.settings.og_default_site_name_string'),
|
||||
'seo.og_default_site_name.max' => __('validation.settings.og_default_site_name_max'),
|
||||
'seo.og_image_default_width.integer' => __('validation.settings.og_image_default_width_integer'),
|
||||
'seo.og_image_default_width.min' => __('validation.settings.og_image_default_width_min'),
|
||||
'seo.og_image_default_width.max' => __('validation.settings.og_image_default_width_max'),
|
||||
'seo.og_image_default_height.integer' => __('validation.settings.og_image_default_height_integer'),
|
||||
'seo.og_image_default_height.min' => __('validation.settings.og_image_default_height_min'),
|
||||
'seo.og_image_default_height.max' => __('validation.settings.og_image_default_height_max'),
|
||||
'seo.twitter_default_card.string' => __('validation.settings.twitter_default_card_string'),
|
||||
'seo.twitter_default_card.in' => __('validation.settings.twitter_default_card_in'),
|
||||
'seo.twitter_default_site.string' => __('validation.settings.twitter_default_site_string'),
|
||||
'seo.twitter_default_site.max' => __('validation.settings.twitter_default_site_max'),
|
||||
'seo.cache_enabled.boolean' => __('validation.settings.seo_cache_enabled_boolean'),
|
||||
'seo.cache_ttl.integer' => __('validation.settings.seo_cache_ttl_integer'),
|
||||
'seo.cache_ttl.min' => __('validation.settings.seo_cache_ttl_min'),
|
||||
@@ -614,6 +643,21 @@ class SaveSettingsRequest extends FormRequest
|
||||
'drivers.log_days.integer' => __('validation.settings.log_days_integer'),
|
||||
'drivers.log_days.min' => __('validation.settings.log_days_min'),
|
||||
'drivers.log_days.max' => __('validation.settings.log_days_max'),
|
||||
|
||||
// 본인인증(IDV) 설정
|
||||
'identity.default_provider.string' => __('validation.settings.identity_default_provider_string'),
|
||||
'identity.default_provider.max' => __('validation.settings.identity_default_provider_max'),
|
||||
'identity.purpose_providers.array' => __('validation.settings.identity_purpose_providers_array'),
|
||||
'identity.purpose_providers.*.string' => __('validation.settings.identity_purpose_provider_string'),
|
||||
'identity.purpose_providers.*.max' => __('validation.settings.identity_purpose_provider_max'),
|
||||
'identity.challenge_ttl_minutes.required' => __('validation.settings.identity_challenge_ttl_required'),
|
||||
'identity.challenge_ttl_minutes.integer' => __('validation.settings.identity_challenge_ttl_integer'),
|
||||
'identity.challenge_ttl_minutes.min' => __('validation.settings.identity_challenge_ttl_min'),
|
||||
'identity.challenge_ttl_minutes.max' => __('validation.settings.identity_challenge_ttl_max'),
|
||||
'identity.max_attempts.required' => __('validation.settings.identity_max_attempts_required'),
|
||||
'identity.max_attempts.integer' => __('validation.settings.identity_max_attempts_integer'),
|
||||
'identity.max_attempts.min' => __('validation.settings.identity_max_attempts_min'),
|
||||
'identity.max_attempts.max' => __('validation.settings.identity_max_attempts_max'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -633,6 +677,11 @@ class SaveSettingsRequest extends FormRequest
|
||||
'general.admin_email' => __('validation.attributes.admin_email'),
|
||||
'general.timezone' => __('validation.attributes.timezone'),
|
||||
'general.language' => __('validation.attributes.language'),
|
||||
// 본인인증(IDV) 필드
|
||||
'identity.default_provider' => __('validation.attributes.identity_default_provider'),
|
||||
'identity.purpose_providers' => __('validation.attributes.identity_purpose_providers'),
|
||||
'identity.challenge_ttl_minutes' => __('validation.attributes.identity_challenge_ttl_minutes'),
|
||||
'identity.max_attempts' => __('validation.attributes.identity_max_attempts'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,9 @@ class IndexTemplateRequest extends FormRequest
|
||||
// 페이지네이션
|
||||
'per_page' => 'nullable|integer|min:1|max:100',
|
||||
'page' => 'nullable|integer|min:1',
|
||||
|
||||
// 숨김 항목 포함 여부 (manifest hidden=true 확장)
|
||||
'include_hidden' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
|
||||
@@ -13,6 +13,11 @@ class InstallTemplateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행되므로
|
||||
* FormRequest 레벨은 항상 통과시킵니다.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
@@ -28,6 +33,12 @@ class InstallTemplateRequest extends FormRequest
|
||||
{
|
||||
$rules = [
|
||||
'template_name' => ['required', 'string', 'max:255', new ValidExtensionIdentifier],
|
||||
// cascade 동반 설치 — install-preview 응답을 바탕으로 사용자가 선택한 항목
|
||||
'dependencies' => ['nullable', 'array'],
|
||||
'dependencies.*.type' => ['required_with:dependencies', 'string', 'in:module,plugin'],
|
||||
'dependencies.*.identifier' => ['required_with:dependencies', 'string', 'max:255'],
|
||||
'language_packs' => ['nullable', 'array'],
|
||||
'language_packs.*' => ['string', 'max:255'],
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
|
||||
@@ -16,6 +16,8 @@ class PerformTemplateUpdateRequest extends FormRequest
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*
|
||||
* @return bool 항상 true (권한은 미들웨어 체인에서 검증)
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
@@ -31,9 +33,11 @@ class PerformTemplateUpdateRequest extends FormRequest
|
||||
{
|
||||
$rules = [
|
||||
'layout_strategy' => ['nullable', 'string', 'in:overwrite,keep'],
|
||||
// 코어 버전 비호환 강제 우회 플래그
|
||||
'force' => ['nullable', 'boolean'],
|
||||
];
|
||||
|
||||
return HookManager::applyFilters('core.template.perform_update_rules', $rules);
|
||||
return HookManager::applyFilters('core.template.perform_update_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Template;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 템플릿 manifest 미리보기 요청.
|
||||
*
|
||||
* 설치 전 ZIP 의 template.json 과 검증 결과만 추출하여 반환합니다 (실제 설치 X).
|
||||
*/
|
||||
class PreviewTemplateManifestRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 권한 체크는 라우트 미들웨어가 담당.
|
||||
*
|
||||
* @return bool 항상 true
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 규칙을 정의합니다.
|
||||
*
|
||||
* @return array<string, mixed> 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$maxSize = config('template.upload_max_size', 50) * 1024;
|
||||
|
||||
return [
|
||||
'file' => ['required', 'file', 'mimes:zip', 'max:'.$maxSize],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 실패 메시지.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
$maxSize = config('template.upload_max_size', 50);
|
||||
|
||||
return [
|
||||
'file.required' => __('templates.validation.file_required'),
|
||||
'file.file' => __('templates.validation.file_invalid'),
|
||||
'file.mimes' => __('templates.validation.file_must_be_zip'),
|
||||
'file.max' => __('templates.validation.file_max_size', ['size' => $maxSize]),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user