adds migration, variables, checkbox,working on groups

This commit is contained in:
Godfrey M 2022-08-25 15:19:38 -07:00
parent 482a7b2a3a
commit fc6fefdb4e
8 changed files with 108 additions and 3 deletions

View file

@ -216,6 +216,14 @@ class LdapSync extends Command
$user->country = $item['country'];
$user->department_id = $department->id;
if($item->ldap_default_group_check == 1){
$permissions_array = $item['ldap_default_group'];
$user->permissions= json_encode($permissions_array);
}
if($item['manager'] != null) {
// Get the LDAP Manager
$ldap_manager = Ldap::findLdapUsers($item['manager'], -1, $this->option('filter'));

View file

@ -955,6 +955,8 @@ class SettingsController extends Controller
$setting->ldap_pword = Crypt::encrypt($request->input('ldap_pword'));
}
$setting->ldap_basedn = $request->input('ldap_basedn');
$setting->ldap_default_group_check = $request->input('ldap_default_group_check');
$setting->ldap_default_group = $request->input('ldap_default_group');
$setting->ldap_filter = $request->input('ldap_filter');
$setting->ldap_username_field = $request->input('ldap_username_field');
$setting->ldap_lname_field = $request->input('ldap_lname_field');

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddsLdapDefaultGroupToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
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');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('ldap_default_group_check');
$table->dropColumn('ldap_default_group');
});
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"/livewire.js":"/livewire.js?id=c69d0f2801c01fcf8166"}
{"/livewire.js":"/livewire.js?id=de3fca26689cb5a39af4"}

View file

@ -75,6 +75,8 @@ return [
'label_logo_size' => 'Square logos look best - will be displayed in the top right of each asset label. ',
'laravel' => 'Laravel Version',
'ldap' => 'LDAP',
'ldap_default_group' => 'Default Permissions Group',
'ldap_default_group_info' => 'Check this box if you would like to apply a permissions group to new LDAP users.',
'ldap_help' => 'LDAP/Active Directory',
'ldap_client_tls_key' => 'LDAP Client TLS Key',
'ldap_client_tls_cert' => 'LDAP Client-Side TLS Certificate',

View file

@ -90,7 +90,64 @@
</div>
</div>
<!-- Default LDAP Permissions Group Check-->
<div class="form-group">
<div class="col-md-3">
{{ Form::label('ldap_default_group', trans('admin/settings/general.ldap_default_group')) }}
</div>
<div class="col-md-9">
{{ 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)
<p class="text-warning"><i class="fas fa-lock" aria-hidden="true"></i> {{ trans('general.feature_disabled') }}</p>
@endif
</div>
</div>
<!-- Default LDAP Permissions Group Select -->
<div class="form-group{{ $errors->has('groups') ? ' has-error' : '' }}">
<label class="col-md-3 control-label" for="groups[]"> {{ trans('general.groups') }}</label>
<div class="col-md-6">
@if ($groups->count())
@if ((Config::get('app.lock_passwords') || (!Auth::user()->isSuperUser())))
@if (count($userGroups->keys()) > 0)
<ul>
@foreach ($groups as $id => $group)
{!! ($userGroups->keys()->contains($id) ? '<li>'.e($group).'</li>' : '') !!}
@endforeach
</ul>
@endif
<span class="help-block">{{ trans('admin/users/general.group_memberships_helpblock') }}</p>
@else
<div class="controls">
<select
name="groups[]"
aria-label="groups[]"
id="groups[]"
multiple="multiple"
class="form-control">
@foreach ($groups as $id => $group)
<option value="{{ $id }}"
{{ ($userGroups->keys()->contains($id) ? ' selected="selected"' : '') }}>
{{ $group }}
</option>
@endforeach
</select>
<span class="help-block">
{{ trans('admin/users/table.groupnotes') }}
</span>
</div>
@endif
@else
<p>No groups have been created yet. Visit <code>Admin Settings > Permission Groups</code> to add one.</p>
@endif
</div>
</div>
<!-- AD Flag -->
<div class="form-group">
<div class="col-md-3">