mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-15 10:04:13 -08:00
0d35335da7
Some checks failed
Crowdin Action / upload-sources-to-crowdin (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
Signed-off-by: snipe <snipe@snipe.net>
39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
class StoreLdapSettings extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return Gate::allows('superuser');
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'ldap_username_field' => 'not_in:sAMAccountName|required_if:ldap_enabled,1',
|
|
'ldap_auth_filter_query' => 'not_in:uid=samaccountname|required_if:ldap_enabled,1',
|
|
'ldap_filter' => 'nullable|regex:"^[^(]"|required_if:ldap_enabled,1',
|
|
'ldap_server' => 'nullable|required_if:ldap_enabled,1|starts_with:ldap://,ldaps://',
|
|
'ldap_uname' => 'nullable|required_if:ldap_enabled,1',
|
|
'ldap_pword' => 'nullable|required_if:ldap_enabled,1',
|
|
'ldap_basedn' => 'nullable|required_if:ldap_enabled,1',
|
|
'ldap_fname_field' => 'nullable|required_if:ldap_enabled,1',
|
|
'custom_forgot_pass_url' => 'nullable|url',
|
|
];
|
|
}
|
|
|
|
}
|