Merge pull request #8373 from snipe/tweak_v5_ldap_migration

Tweak v5 ldap migration for backwards-compatibility with working pre-v5 Active Directory setups
This commit is contained in:
snipe 2020-08-26 13:34:25 -07:00 committed by GitHub
commit 9f5669e70a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
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.