From 6e9f36be583e8ad8fef3261ab0446bc891432f03 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Wed, 26 Aug 2020 13:09:32 -0700 Subject: [PATCH] Update ad_append_domain setting for backwards-compatibility with v4 and earlier --- .../2020_02_04_172100_add_ad_append_domain_settings.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/database/migrations/2020_02_04_172100_add_ad_append_domain_settings.php b/database/migrations/2020_02_04_172100_add_ad_append_domain_settings.php index 4fce7f4558..a9afdc2765 100644 --- a/database/migrations/2020_02_04_172100_add_ad_append_domain_settings.php +++ b/database/migrations/2020_02_04_172100_add_ad_append_domain_settings.php @@ -3,6 +3,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; +use App\Models\Setting; class AddAdAppendDomainSettings extends Migration { @@ -16,7 +17,13 @@ class AddAdAppendDomainSettings extends Migration Schema::table('settings', function (Blueprint $table) { $table->boolean('ad_append_domain')->nullable(false)->default('0'); }); - } + $s = Setting::first(); // we are deliberately *not* using the ::getSettings() method, as it caches things, and our Settings table is being migrated right now + \Log::info("is ad? ".($s->is_ad)." is enabled? ".($s->ldap_enabled)." ad_domain? ".($s->ad_domain)); + if($s->is_ad && $s->ldap_enabled && $s->ad_domain) { //backwards-compatibility setting; < v5 always appended AD Domains + $s->ad_append_domain = 1; + $s->save(); + } +} /** * Reverse the migrations.