From d1e2f9db34f3adad650c09d078cb11f873e7b3c8 Mon Sep 17 00:00:00 2001 From: Maciej Poleszczyk Date: Wed, 25 Sep 2024 17:56:49 +0200 Subject: [PATCH 1/6] Fixing #15064 - to not fail ldap sync on single data issue with ldap manager --- app/Console/Commands/LdapSync.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index 62fda07892..8bde0c6e12 100644 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -320,22 +320,29 @@ class LdapSync extends Command ] ]; } - + + $add_manager_to_cache = true; if ($ldap_manager["count"] > 0) { + try { + // Get the Manager's username + // PHP LDAP returns every LDAP attribute as an array, and 90% of the time it's an array of just one item. But, hey, it's an array. + $ldapManagerUsername = $ldap_manager[0][$ldap_map["username"]][0]; - // Get the Manager's username - // PHP LDAP returns every LDAP attribute as an array, and 90% of the time it's an array of just one item. But, hey, it's an array. - $ldapManagerUsername = $ldap_manager[0][$ldap_map["username"]][0]; + // Get User from Manager username. + $ldap_manager = User::where('username', $ldapManagerUsername)->first(); - // Get User from Manager username. - $ldap_manager = User::where('username', $ldapManagerUsername)->first(); - - if ($ldap_manager && isset($ldap_manager->id)) { - // Link user to manager id. - $user->manager_id = $ldap_manager->id; + if ($ldap_manager && isset($ldap_manager->id)) { + // Link user to manager id. + $user->manager_id = $ldap_manager->id; + } + } catch (\Exception $e) { + $add_manager_to_cache = false; + \Log::warning('Handling ldap manager ' . $item['manager'] . ' caused an exception: ' . $e->getMessage() . '. Continuing synchronization.'); } } - $manager_cache[$item['manager']] = $ldap_manager && isset($ldap_manager->id) ? $ldap_manager->id : null; // Store results in cache, even if 'failed' + if ($add_manager_to_cache) { + $manager_cache[$item['manager']] = $ldap_manager && isset($ldap_manager->id) ? $ldap_manager->id : null; // Store results in cache, even if 'failed' + } } } From f7dcfca66c32355c7bf2485758e13a64fdd73507 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 13 Nov 2024 23:46:04 +0000 Subject: [PATCH 2/6] Bumped version Signed-off-by: snipe --- config/version.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/version.php b/config/version.php index 4ffe2cdb6b..cc5319babb 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v7.0.14-pre', - 'full_app_version' => 'v7.0.14-pre - build 15942-g3bf33aa68', + 'app_version' => 'v7.0.14', + 'full_app_version' => 'v7.0.14 - build 15942-g3bf33aa68', 'build_version' => '15942', 'prerelease_version' => '', 'hash_version' => 'g3bf33aa68', - 'full_hash' => 'v7.0.14-pre-420-g3bf33aa68', + 'full_hash' => 'v7.0.14-420-g3bf33aa68', 'branch' => 'develop', ); \ No newline at end of file From a060f603b5649359286951aadc5b9b38e4f2fd5d Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 14 Nov 2024 01:11:01 +0000 Subject: [PATCH 3/6] Versioning stuff is hard - fixed v7.0.14 to v7.1.14 Signed-off-by: snipe --- config/version.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/version.php b/config/version.php index cc5319babb..ea22a52cd2 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v7.0.14', - 'full_app_version' => 'v7.0.14 - build 15942-g3bf33aa68', + 'app_version' => 'v7.1.14', + 'full_app_version' => 'v7.1.14 - build 15942-g3bf33aa68', 'build_version' => '15942', 'prerelease_version' => '', 'hash_version' => 'g3bf33aa68', - 'full_hash' => 'v7.0.14-420-g3bf33aa68', + 'full_hash' => 'v7.1.14-420-g3bf33aa68', 'branch' => 'develop', ); \ No newline at end of file From 4e28650ca9f3c6fd0cc85ac9a443db36847a9248 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 14 Nov 2024 10:18:39 +0000 Subject: [PATCH 4/6] Specify table name in select Signed-off-by: snipe --- .../Controllers/Api/AssetModelsController.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index bfcb9d1696..33a00d1d3f 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -56,17 +56,17 @@ class AssetModelsController extends Controller 'models.id', 'models.image', 'models.name', - 'model_number', - 'min_amt', - 'eol', - 'created_by', - 'requestable', + 'models.model_number', + 'models.min_amt', + 'models.eol', + 'models.created_by', + 'models.requestable', 'models.notes', 'models.created_at', - 'category_id', - 'manufacturer_id', - 'depreciation_id', - 'fieldset_id', + 'models.category_id', + 'models.manufacturer_id', + 'models.depreciation_id', + 'models.fieldset_id', 'models.deleted_at', 'models.updated_at', ]) From 3e131d515d77388e17f8cbe57b30933baeb2ec35 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 14 Nov 2024 11:06:55 +0000 Subject: [PATCH 5/6] Add @maciej-poleszczyk as a contributor --- .all-contributorsrc | 9 +++++++++ CONTRIBUTORS.md | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index c8156f6f0e..d6c82c2976 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -3226,6 +3226,15 @@ "contributions": [ "code" ] + }, + { + "login": "maciej-poleszczyk", + "name": "maciej-poleszczyk", + "avatar_url": "https://avatars.githubusercontent.com/u/133033121?v=4", + "profile": "https://github.com/maciej-poleszczyk", + "contributions": [ + "code" + ] } ] } diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 49d1588f6b..f9fcd3e5d4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -52,7 +52,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken | [
bilias](https://github.com/bilias)
[💻](https://github.com/snipe/snipe-it/commits?author=bilias "Code") | [
coach1988](https://github.com/coach1988)
[💻](https://github.com/snipe/snipe-it/commits?author=coach1988 "Code") | [
MrM](https://github.com/mauro-miatello)
[💻](https://github.com/snipe/snipe-it/commits?author=mauro-miatello "Code") | [
koiakoia](https://github.com/koiakoia)
[💻](https://github.com/snipe/snipe-it/commits?author=koiakoia "Code") | [
Mustafa Online](https://github.com/mustafa-online)
[💻](https://github.com/snipe/snipe-it/commits?author=mustafa-online "Code") | [
franceslui](https://github.com/franceslui)
[💻](https://github.com/snipe/snipe-it/commits?author=franceslui "Code") | [
Q4kK](https://github.com/Q4kK)
[💻](https://github.com/snipe/snipe-it/commits?author=Q4kK "Code") | | [
squintfox](https://github.com/squintfox)
[💻](https://github.com/snipe/snipe-it/commits?author=squintfox "Code") | [
Jeff Clay](https://github.com/jeffclay)
[💻](https://github.com/snipe/snipe-it/commits?author=jeffclay "Code") | [
Phil J R](https://github.com/PP-JN-RL)
[💻](https://github.com/snipe/snipe-it/commits?author=PP-JN-RL "Code") | [
i_virus](https://www.corelight.com/)
[💻](https://github.com/snipe/snipe-it/commits?author=chandanchowdhury "Code") | [
Paul Grime](https://github.com/gitgrimbo)
[💻](https://github.com/snipe/snipe-it/commits?author=gitgrimbo "Code") | [
Lee Porte](https://leeporte.co.uk)
[💻](https://github.com/snipe/snipe-it/commits?author=LeePorte "Code") | [
BRYAN ](https://github.com/bryanlopezinc)
[💻](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Code") [⚠️](https://github.com/snipe/snipe-it/commits?author=bryanlopezinc "Tests") | | [
U-H-T](https://github.com/U-H-T)
[💻](https://github.com/snipe/snipe-it/commits?author=U-H-T "Code") | [
Matt Tyree](https://github.com/Tyree)
[📖](https://github.com/snipe/snipe-it/commits?author=Tyree "Documentation") | [
Florent Bervas](http://spoontux.net)
[💻](https://github.com/snipe/snipe-it/commits?author=FlorentDotMe "Code") | [
Daniel Albertsen](https://ditscheri.com)
[💻](https://github.com/snipe/snipe-it/commits?author=dbakan "Code") | [
r-xyz](https://github.com/r-xyz)
[💻](https://github.com/snipe/snipe-it/commits?author=r-xyz "Code") | [
Steven Mainor](https://github.com/DrekiDegga)
[💻](https://github.com/snipe/snipe-it/commits?author=DrekiDegga "Code") | [
arne-kroeger](https://github.com/arne-kroeger)
[💻](https://github.com/snipe/snipe-it/commits?author=arne-kroeger "Code") | -| [
Glukose1](https://github.com/Glukose1)
[💻](https://github.com/snipe/snipe-it/commits?author=Glukose1 "Code") | [
Scarzy](https://github.com/Scarzy)
[💻](https://github.com/snipe/snipe-it/commits?author=Scarzy "Code") | [
setpill](https://github.com/setpill)
[💻](https://github.com/snipe/snipe-it/commits?author=setpill "Code") | [
swift2512](https://github.com/swift2512)
[🐛](https://github.com/snipe/snipe-it/issues?q=author%3Aswift2512 "Bug reports") | [
Darren Rainey](https://darrenraineys.co.uk)
[💻](https://github.com/snipe/snipe-it/commits?author=DarrenRainey "Code") | +| [
Glukose1](https://github.com/Glukose1)
[💻](https://github.com/snipe/snipe-it/commits?author=Glukose1 "Code") | [
Scarzy](https://github.com/Scarzy)
[💻](https://github.com/snipe/snipe-it/commits?author=Scarzy "Code") | [
setpill](https://github.com/setpill)
[💻](https://github.com/snipe/snipe-it/commits?author=setpill "Code") | [
swift2512](https://github.com/swift2512)
[🐛](https://github.com/snipe/snipe-it/issues?q=author%3Aswift2512 "Bug reports") | [
Darren Rainey](https://darrenraineys.co.uk)
[💻](https://github.com/snipe/snipe-it/commits?author=DarrenRainey "Code") | [
maciej-poleszczyk](https://github.com/maciej-poleszczyk)
[💻](https://github.com/snipe/snipe-it/commits?author=maciej-poleszczyk "Code") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! From 940f1c2eccb1966c1db24d05e41814f056e84fe5 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 14 Nov 2024 12:24:15 +0000 Subject: [PATCH 6/6] Fixed #15812 - regression in action_type search Signed-off-by: snipe --- app/Http/Controllers/Api/ReportsController.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Http/Controllers/Api/ReportsController.php b/app/Http/Controllers/Api/ReportsController.php index 63fca39d19..1a86e51684 100644 --- a/app/Http/Controllers/Api/ReportsController.php +++ b/app/Http/Controllers/Api/ReportsController.php @@ -44,6 +44,22 @@ class ReportsController extends Controller }); } + if ($request->filled('action_type')) { + $actionlogs = $actionlogs->where('action_type', '=', $request->input('action_type'))->orderBy('created_at', 'desc'); + } + + if ($request->filled('created_by')) { + $actionlogs = $actionlogs->where('created_by', '=', $request->input('created_by')); + } + + if ($request->filled('action_source')) { + $actionlogs = $actionlogs->where('action_source', '=', $request->input('action_source'))->orderBy('created_at', 'desc'); + } + + if ($request->filled('remote_ip')) { + $actionlogs = $actionlogs->where('remote_ip', '=', $request->input('remote_ip'))->orderBy('created_at', 'desc'); + } + if ($request->filled('uploads')) { $actionlogs = $actionlogs->whereNotNull('filename')->orderBy('created_at', 'desc');