mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
Merge branch 'integrations/rc5-4-2020-08-31-dev-into-master' into develop
This commit is contained in:
commit
b258f34bce
|
@ -57,7 +57,7 @@ class LdapAd extends LdapAdConfiguration
|
|||
public function init()
|
||||
{
|
||||
// Already initialized
|
||||
if($this->ldap) {
|
||||
if ($this->ldap) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,10 +52,19 @@ class LdapAdConfiguration
|
|||
* @since 5.0.0
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
// This try/catch is dumb, but is necessary to run initial migrations, since
|
||||
// this service provider is booted even during migrations. :( - snipe
|
||||
try {
|
||||
$this->ldapSettings = $this->getSnipeItLdapSettings();
|
||||
if ($this->isLdapEnabled()) {
|
||||
$this->setSnipeItConfig();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
\Log::debug($e);
|
||||
$this->ldapSettings = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,6 +91,8 @@ class LdapAdConfiguration
|
|||
*/
|
||||
private function getSnipeItLdapSettings(): Collection
|
||||
{
|
||||
$ldapSettings = collect();
|
||||
if(Setting::first()) { // during early migration steps, there may be no settings table entry to start with
|
||||
$ldapSettings = Setting::getLdapSettings()
|
||||
->map(function ($item, $key) {
|
||||
// Trim the items
|
||||
|
@ -108,7 +119,7 @@ class LdapAdConfiguration
|
|||
|
||||
return $item;
|
||||
});
|
||||
|
||||
}
|
||||
return $ldapSettings;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class AddAdAppendDomainSettings extends Migration
|
|||
});
|
||||
|
||||
$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
|
||||
if ($s && $s->is_ad && $s->ldap_enabled && $s->ad_domain) { //backwards-compatibility setting; < v5 always appended AD Domains
|
||||
$s->ad_append_domain = 1;
|
||||
$s->save();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue