From ab33c2dce9645606c27d1222d57b6906c7a150d7 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 21 Jun 2025 09:51:03 +1000 Subject: [PATCH] Enable disabling internal templates, as well as having custom templates --- app/Ldap/Entry.php | 5 ++++- config/pla.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Ldap/Entry.php b/app/Ldap/Entry.php index 21ef355c..11440012 100644 --- a/app/Ldap/Entry.php +++ b/app/Ldap/Entry.php @@ -53,7 +53,10 @@ class Entry extends Model $template_dir = Storage::disk(config('pla.template.dir')); $templates = collect(); - foreach (array_filter($template_dir->files(),fn($item)=>Str::endsWith($item,'.json')) as $file) { + foreach (array_filter($template_dir->files('.',TRUE),fn($item)=>Str::endsWith($item,'.json')) as $file) { + if (config('pla.template.exclude_system',FALSE) && Str::doesntContain($file,'/')) + continue; + $to = new Template($file); if ($to->invalid) { diff --git a/config/pla.php b/config/pla.php index 7a09ef87..0c4f4df6 100644 --- a/config/pla.php +++ b/config/pla.php @@ -94,5 +94,6 @@ return [ 'template' => [ 'dir' => env('LDAP_TEMPLATE_DRIVER','templates'), + 'exclude_system' => env('LDAP_TEMPLATE_EXCLUDE_SYSTEM',FALSE), ], ]; \ No newline at end of file