BastionSSO/app/Http/Requests/StoreServerResourceRequest.php

36 lines
1.4 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreServerResourceRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255', 'regex:/^[A-Za-z][A-Za-z0-9._-]*$/'],
'display_name' => ['nullable', 'string', 'max:255'],
'parent_id' => ['nullable', 'integer', 'exists:server_resources,id'],
'internal_ip' => ['nullable', 'ip'],
'user_api_base_url' => ['nullable', 'url', 'max:255'],
'user_api_token' => ['nullable', 'string', 'max:2000'],
'default_environment_variables' => ['nullable', 'string', 'max:20000'],
'all_user_environment_variables' => ['nullable', 'string', 'max:20000'],
'default_user_groups' => ['sometimes', 'array'],
'default_user_groups.*' => ['string', 'max:32', 'regex:/^[a-z_][a-z0-9_-]{0,31}$/'],
'asset_id' => ['nullable', 'integer', 'min:1'],
'account_id' => ['nullable', 'integer', 'min:1'],
'protocol' => ['nullable', 'string', 'max:64'],
'description' => ['nullable', 'string', 'max:255'],
'allow_copy_temp_password' => ['sometimes', 'boolean'],
'is_active' => ['sometimes', 'boolean'],
];
}
}