Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Ldap Company as option and FMCS Notification #14650

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3f0546e
adds Ldap Company as a syncable field
Godmartinz Apr 25, 2024
a8f26e2
added migration to git
Godmartinz Apr 25, 2024
6fca0c6
fixed migration
Godmartinz Apr 25, 2024
5b666ad
little fix
Godmartinz Apr 25, 2024
88f83f3
imported Company to ldapsync
Godmartinz Apr 25, 2024
9663810
getting queries setup for notifications
Godmartinz May 6, 2024
214e8f5
assets and license queries working as intended
Godmartinz May 7, 2024
a089ca4
adds accessorycheckoutmodel and queries work
Godmartinz May 7, 2024
d56aaae
formatted model better
Godmartinz May 7, 2024
14fa09c
removed dead code, small fixes
Godmartinz May 7, 2024
b6747a7
fixes front end notifications
Godmartinz May 7, 2024
6015936
mashing my brain over the polymorphic query
Godmartinz May 8, 2024
cf702c4
adds fmcs check, adds empty notification message
Godmartinz May 8, 2024
4ad027e
removed translation
Godmartinz May 8, 2024
5d7588b
reworded translation
Godmartinz May 8, 2024
acb6cb8
fixes assets query to pay attention to well..assets
Godmartinz May 9, 2024
7c7031f
change
Godmartinz May 9, 2024
43a9657
conflict resolved
Godmartinz May 9, 2024
d1074b7
Merge branch 'develop' into ldap_company_add
Godmartinz May 9, 2024
3e26f17
made query more readable
Godmartinz May 9, 2024
180b94e
fix conflicts
Godmartinz Aug 13, 2024
5b89985
merged develop
Godmartinz Aug 13, 2024
8d792de
fixed conflicts
Godmartinz Aug 13, 2024
1ec006a
fix merged conflicts
Godmartinz Oct 7, 2024
9879a3f
fixed relations with new Accessory Checkout Model
Godmartinz Oct 7, 2024
76d52de
attempting a fix on assignedTo relation
Godmartinz Oct 7, 2024
c8e2a10
flipped tghe owner_key and id
Godmartinz Oct 7, 2024
3ed039e
fixed a relation
Godmartinz Oct 8, 2024
331f9bf
stop dynamically naming assets table
Godmartinz Oct 8, 2024
c6b559c
simplified table name and rewrote alias
Godmartinz Oct 8, 2024
3574fb6
added select to query to avoid ambiguity
Godmartinz Oct 8, 2024
2de5a7e
Merge branch 'develop' into ldap_company_add
Godmartinz Nov 26, 2024
c8d7fae
fix table select in query
Godmartinz Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/Console/Commands/LdapSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function handle()
$ldap_result_jobtitle = Setting::getSettings()->ldap_jobtitle;
$ldap_result_country = Setting::getSettings()->ldap_country;
$ldap_result_location = Setting::getSettings()->ldap_location;
$ldap_result_company = Setting::getSettings()->ldap_company;
$ldap_result_dept = Setting::getSettings()->ldap_dept;
$ldap_result_manager = Setting::getSettings()->ldap_manager;
$ldap_default_group = Setting::getSettings()->ldap_default_group;
Expand Down Expand Up @@ -230,13 +231,19 @@ public function handle()
$item['department'] = $results[$i][$ldap_result_dept][0] ?? '';
$item['manager'] = $results[$i][$ldap_result_manager][0] ?? '';
$item['location'] = $results[$i][$ldap_result_location][0] ?? '';
$item['company'] = $results[$i][$ldap_result_company][0] ?? '';

// ONLY if you are using the "ldap_location" option *AND* you have an actual result
if ($ldap_result_location && $item['location']) {
$location = Location::firstOrCreate([
'name' => $item['location'],
]);
}
if ($ldap_result_company && $item['company']) {
$company = Company::firstOrCreate([
'name' => $item['company'],
]);
}
$department = Department::firstOrCreate([
'name' => $item['department'],
]);
Expand Down Expand Up @@ -284,6 +291,9 @@ public function handle()
if($ldap_result_location != null){
$user->location_id = $location ? $location->id : null;
}
if($ldap_result_company != null){
$user->company_id = $company ? $company->id : null;
}

if($ldap_result_manager != null){
if($item['manager'] != null) {
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@ public function postLdapSettings(Request $request)
$setting->ldap_jobtitle = $request->input('ldap_jobtitle');
$setting->ldap_country = $request->input('ldap_country');
$setting->ldap_location = $request->input('ldap_location');
$setting->ldap_company = $request->input('ldap_company');
$setting->ldap_dept = $request->input('ldap_dept');
$setting->ldap_client_tls_cert = $request->input('ldap_client_tls_cert');
$setting->ldap_client_tls_key = $request->input('ldap_client_tls_key');
Expand Down
1 change: 1 addition & 0 deletions app/Models/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ public static function getLdapSettings(): Collection
'ldap_phone_field',
'ldap_jobtitle',
'ldap_manager',
'ldap_company',
'ldap_country',
'ldap_location',
])->first()->getAttributes();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddLdapCompanyToSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('ldap_company')->after('ldap_jobtitle')->nullable()->default(null);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('ldap_company');

});
}
}
1 change: 1 addition & 0 deletions resources/lang/en-US/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
'ldap_phone' => 'LDAP Telephone Number',
'ldap_jobtitle' => 'LDAP Job Title',
'ldap_country' => 'LDAP Country',
'ldap_company' => 'LDAP Company',
'ldap_pword' => 'LDAP Bind Password',
'ldap_basedn' => 'Base Bind DN',
'ldap_filter' => 'LDAP Filter',
Expand Down
13 changes: 13 additions & 0 deletions resources/views/settings/ldap.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,19 @@
@endif
</div>
</div>
<!-- LDAP Company -->
<div class="form-group {{ $errors->has('ldap_company') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('ldap_company', trans('admin/settings/general.ldap_company')) }}
</div>
<div class="col-md-8">
{{ Form::text('ldap_company', Request::old('ldap_company', $setting->ldap_company), ['class' => 'form-control','placeholder' => trans('general.example') .'company', $setting->demoMode]) }}
{!! $errors->first('ldap_company', '<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 Location -->
<div class="form-group {{ $errors->has('ldap_location') ? 'error' : '' }}">
<div class="col-md-3">
Expand Down
Loading