mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
Add LDAP port number option
This commit is contained in:
parent
cc6b2a0081
commit
ba25972b49
|
@ -400,6 +400,7 @@ class SettingsController extends Controller
|
|||
$setting->ldap_server = e(Input::get('ldap_server'));
|
||||
$setting->ldap_server_cert_ignore = e(Input::get('ldap_server_cert_ignore', false));
|
||||
$setting->ldap_uname = e(Input::get('ldap_uname'));
|
||||
$setting->ldap_port = e(Input::get('ldap_port'));
|
||||
if (Input::has('ldap_pword')) {
|
||||
$setting->ldap_pword = Crypt::encrypt(Input::get('ldap_pword'));
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ class Ldap extends Model
|
|||
{
|
||||
|
||||
$ldap_host = Setting::getSettings()->ldap_server;
|
||||
$ldap_port = Setting::getSettings()->ldap_port;
|
||||
$ldap_version = Setting::getSettings()->ldap_version;
|
||||
$ldap_server_cert_ignore = Setting::getSettings()->ldap_server_cert_ignore;
|
||||
|
||||
|
@ -34,11 +35,10 @@ class Ldap extends Model
|
|||
putenv('LDAPTLS_REQCERT=never');
|
||||
}
|
||||
|
||||
// Connecting to LDAP
|
||||
$connection = @ldap_connect($ldap_host) or die("Could not connect to {$ldap_host}");
|
||||
$connection = @ldap_connect($ldap_host,$ldap_port);
|
||||
|
||||
if (!$connection) {
|
||||
throw new Exception('Could not connect to LDAP server at '.$ldap_host.': '.ldap_error($connection));
|
||||
throw new Exception('Could not connect to LDAP server at '.$ldap_host.' on port '.$ldap_port.'. Please check your LDAP server name and port number in your settings.');
|
||||
}
|
||||
|
||||
// Needed for AD
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddPortToLdapSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->string('ldap_port', 5)->default('389');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function ($table) {
|
||||
$table->dropColumn('ldap_port');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -47,6 +47,8 @@ return array(
|
|||
'ldap_server_cert_help' => 'Select this checkbox if you are using a self signed SSL cert and would like to accept an invalid SSL certificate.',
|
||||
'ldap_uname' => 'LDAP Bind Username',
|
||||
'ldap_pword' => 'LDAP Bind Password',
|
||||
'ldap_port' => 'LDAP Port',
|
||||
'ldap_port_help' => 'This is usually 389 for ldap, 636 for ldaps.',
|
||||
'ldap_basedn' => 'Base Bind DN',
|
||||
'ldap_filter' => 'LDAP Filter',
|
||||
'ldap_username_field' => 'Username Field',
|
||||
|
|
|
@ -726,6 +726,27 @@
|
|||
{!! $errors->first('ldap_server', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div><!-- LDAP Server -->
|
||||
|
||||
<!-- LDAP port -->
|
||||
<div class="form-group {{ $errors->has('ldap_port') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('ldap_port', trans('admin/settings/general.ldap_port')) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
@if (config('app.lock_passwords')===true)
|
||||
{{ Form::text('ldap_port', Input::old('ldap_port', $setting->ldap_port), array('class' => 'form-control', 'disabled'=>'disabled','placeholder' => '389')) }}
|
||||
@else
|
||||
{{ Form::text('ldap_port', Input::old('ldap_port', $setting->ldap_port), array('class' => 'form-control','placeholder' => '389')) }}
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-8 col-md-offset-3">
|
||||
|
||||
<p class="help-block">{{ trans('admin/settings/general.ldap_port_help') }}</p>
|
||||
{!! $errors->first('ldap_port', '<span class="alert-msg">:message</span>') !!}
|
||||
</div>
|
||||
</div><!-- LDAP Server -->
|
||||
|
||||
|
||||
<div class="form-group {{ $errors->has('ldap_server_cert_ignore') ? 'error' : '' }}">
|
||||
<div class="col-md-3">
|
||||
{{ Form::label('ldap_server_cert_ignore', trans('admin/settings/general.ldap_server_cert')) }}
|
||||
|
|
|
@ -150,7 +150,8 @@
|
|||
<td>{{ trans('admin/settings/general.ldap_integration') }}</td>
|
||||
|
||||
@if ($setting->ldap_enabled == 1)
|
||||
<td>{{ trans('general.yes') }}
|
||||
<td>
|
||||
{{ $setting->ldap_server }}:{{ $setting->ldap_port }}
|
||||
@if ($setting->is_ad == '1')
|
||||
(Active Directory)
|
||||
@endif
|
||||
|
|
Loading…
Reference in a new issue