mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
WIP: needs to be tested. adds ldap_manager field to ldap sync
This commit is contained in:
parent
820f0a7f04
commit
4956eb0410
|
@ -946,6 +946,7 @@ class SettingsController extends Controller
|
|||
$setting->ldap_active_flag = $request->input('ldap_active_flag');
|
||||
$setting->ldap_emp_num = $request->input('ldap_emp_num');
|
||||
$setting->ldap_email = $request->input('ldap_email');
|
||||
$setting->ldap_manager = $request->input('ldap_manager');
|
||||
$setting->ad_domain = $request->input('ad_domain');
|
||||
$setting->is_ad = $request->input('is_ad', '0');
|
||||
$setting->ad_append_domain = $request->input('ad_append_domain', '0');
|
||||
|
|
|
@ -208,6 +208,7 @@ class Ldap extends Model
|
|||
$ldap_result_jobtitle = Setting::getSettings()->ldap_jobtitle;
|
||||
$ldap_result_country = Setting::getSettings()->ldap_country;
|
||||
$ldap_result_dept = Setting::getSettings()->ldap_dept;
|
||||
$ldap_result_manager = Setting::getSettings()->ldap_manager;
|
||||
// Get LDAP user data
|
||||
$item = [];
|
||||
$item['username'] = isset($ldapattributes[$ldap_result_username][0]) ? $ldapattributes[$ldap_result_username][0] : '';
|
||||
|
@ -219,6 +220,7 @@ class Ldap extends Model
|
|||
$item['jobtitle'] = isset($ldapattributes[$ldap_result_jobtitle][0]) ? $ldapattributes[$ldap_result_jobtitle][0] : '';
|
||||
$item['country'] = isset($ldapattributes[$ldap_result_country][0]) ? $ldapattributes[$ldap_result_country][0] : '';
|
||||
$item['department'] = isset($ldapattributes[$ldap_result_dept][0]) ? $ldapattributes[$ldap_result_dept][0] : '';
|
||||
$item['manager'] = isset($ldapattributes[$ldap_result_manager][0]) ? $ldapattributes[$ldap_result_manager][0] : '';
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
|
34
database/migrations/2022_03_21_162724_adds_ldap_manager.php
Normal file
34
database/migrations/2022_03_21_162724_adds_ldap_manager.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddsLdapManager extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//Updates the Settings Table
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->string('ldap_manager')->after('ldap_jobtitle')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->dropColumn('ldap_manager');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -84,6 +84,7 @@ return [
|
|||
'ldap_client_tls_key' => 'LDAP Client-Side TLS key',
|
||||
'ldap_login_test_help' => 'Enter a valid LDAP username and password from the base DN you specified above to test whether your LDAP login is configured correctly. YOU MUST SAVE YOUR UPDATED LDAP SETTINGS FIRST.',
|
||||
'ldap_login_sync_help' => 'This only tests that LDAP can sync correctly. If your LDAP Authentication query is not correct, users may still not be able to login. YOU MUST SAVE YOUR UPDATED LDAP SETTINGS FIRST.',
|
||||
'ldap_manager' => 'LDAP Manager',
|
||||
'ldap_server' => 'LDAP Server',
|
||||
'ldap_server_help' => 'This should start with ldap:// (for unencrypted or TLS) or ldaps:// (for SSL)',
|
||||
'ldap_server_cert' => 'LDAP SSL certificate validation',
|
||||
|
|
|
@ -383,6 +383,19 @@
|
|||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<!-- LDAP Manager -->
|
||||
<div class="form-group {{ $errors->has('ldap_dept') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('ldap_dept', trans('admin/settings/general.ldap_manager')) }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
{{ Form::text('ldap_manager', Request::old('ldap_manager', $setting->ldap_manager), ['class' => 'form-control','placeholder' => 'manager', $setting->demoMode]) }}
|
||||
{!! $errors->first('ldap_manager', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
@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>
|
||||
|
||||
<!-- LDAP email -->
|
||||
<div class="form-group {{ $errors->has('ldap_email') ? 'error' : '' }}">
|
||||
|
|
Loading…
Reference in a new issue