From f1ad5461d8df6ce9385c1d08de009cb0f49ae58c Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 14 Apr 2016 11:59:01 -0700 Subject: [PATCH] Feature: Artisan command to allow you to disable LDAP in case you lock yourself out. --- app/Console/Commands/DisableLDAP.php | 57 ++++++++++++++++++++++++++++ app/Console/Kernel.php | 1 + 2 files changed, 58 insertions(+) create mode 100644 app/Console/Commands/DisableLDAP.php diff --git a/app/Console/Commands/DisableLDAP.php b/app/Console/Commands/DisableLDAP.php new file mode 100644 index 000000000..906cd46c7 --- /dev/null +++ b/app/Console/Commands/DisableLDAP.php @@ -0,0 +1,57 @@ +confirm("\n****************************************************\nThis will disable LDAP support. You will not be able \nto login with an account that does not exist \nlocally in the Snipe-IT local database. \n****************************************************\n\nDo you wish to continue? [y|N]")) { + + $setting = Setting::first(); + $setting->ldap_enabled = 0; + if ($setting->save()) { + $this->info('LDAP has been set to disabled.'); + } else { + $this->info('Unable to disable LDAP.'); + } + } else { + $this->info('Canceled. No actions taken.'); + } + + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index bc508454f..67a90430c 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -21,6 +21,7 @@ class Kernel extends ConsoleKernel Commands\LicenseImportCommand::class, Commands\Versioning::class, Commands\SystemBackup::class, + Commands\DisableLDAP::class, ]; /**