phpldapadmin/app/Rules/DNExists.php
Deon George 4ba0bffe9f
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 26s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m22s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 4m29s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s
Start of work to enable creation of new entries
2025-02-25 17:30:17 +11:00

22 lines
543 B
PHP

<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Support\Facades\Crypt;
class DNExists implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute,mixed $value,Closure $fail): void
{
if (! config('server')->fetch($x=Crypt::decryptString($value)))
$fail(sprintf('The DN %s doesnt exist.',$x));
}
}