diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index 12d683c822..d8ce6f7e7a 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -216,7 +216,7 @@ class LdapSync extends Command $user->country = $item['country']; $user->department_id = $department->id; - if($item->ldap_default_group_check == 1){ + if($item->ldap_default_group != null){ $permissions_array = $item['ldap_default_group']; $user->permissions= json_encode($permissions_array); diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 7379f359b3..4897ac1cda 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -7,6 +7,7 @@ use App\Helpers\StorageHelper; use App\Http\Requests\ImageUploadRequest; use App\Http\Requests\SettingsSamlRequest; use App\Http\Requests\SetupUserRequest; +use App\Models\Group; use App\Models\Setting; use App\Models\Asset; use App\Models\User; @@ -910,6 +911,8 @@ class SettingsController extends Controller public function getLdapSettings() { $setting = Setting::getSettings(); + $groups = Group::pluck('name', 'id'); + /** * This validator is only temporary (famous last words.) - @snipe @@ -928,7 +931,7 @@ class SettingsController extends Controller - return view('settings.ldap', compact('setting'))->withErrors($validator); + return view('settings.ldap', compact('setting', 'groups'))->withErrors($validator); } /** diff --git a/database/migrations/2022_08_25_213308_adds_ldap_default_group_to_settings_table.php b/database/migrations/2022_08_25_213308_adds_ldap_default_group_to_settings_table.php index 2c522a43a4..3590d1ecdb 100644 --- a/database/migrations/2022_08_25_213308_adds_ldap_default_group_to_settings_table.php +++ b/database/migrations/2022_08_25_213308_adds_ldap_default_group_to_settings_table.php @@ -14,10 +14,8 @@ class AddsLdapDefaultGroupToSettingsTable extends Migration public function up() { Schema::table('settings', function (Blueprint $table) { - $table->boolean('ldap_default_group_check') - ->after('ldap_base_dn'); - $table->boolean('ldap_default_group') - ->after('ldap_default_group_check'); + $table->string('ldap_default_group') + ->after('ldap_base_dn'); }); } @@ -29,7 +27,6 @@ class AddsLdapDefaultGroupToSettingsTable extends Migration public function down() { Schema::table('settings', function (Blueprint $table) { - $table->dropColumn('ldap_default_group_check'); $table->dropColumn('ldap_default_group'); }); } diff --git a/resources/views/settings/ldap.blade.php b/resources/views/settings/ldap.blade.php index 3db70de074..157dd0c86c 100644 --- a/resources/views/settings/ldap.blade.php +++ b/resources/views/settings/ldap.blade.php @@ -90,19 +90,7 @@ - -
-
- {{ Form::label('ldap_default_group', trans('admin/settings/general.ldap_default_group')) }} -
-
- {{ Form::checkbox('ldap_default_group', '1', Request::old('ldap_default_group', $setting->ldap_default_group), [((config('app.lock_passwords')===true)) ? 'disabled ': '', 'class' => 'minimal '. $setting->demoMode, $setting->demoMode]) }} - {{ trans('admin/settings/general.ldap_default_group_info') }} - @if (config('app.lock_passwords')===true) -

{{ trans('general.feature_disabled') }}

- @endif -
-
+
@@ -110,16 +98,14 @@ @if ($groups->count()) @if ((Config::get('app.lock_passwords') || (!Auth::user()->isSuperUser()))) + - @if (count($userGroups->keys()) > 0) - - @endif - {{ trans('admin/users/general.group_memberships_helpblock') }}

+ {{ trans('admin/users/general.group_memberships_helpblock') }} @else