From 434068a2ed8cbceef43746a551230a259c3479ef Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 17 Jan 2025 17:49:19 +0000 Subject: [PATCH 1/8] Fixes #16000 - add S3 support for eula PDF downloads Signed-off-by: snipe --- app/Http/Controllers/ActionlogController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ActionlogController.php b/app/Http/Controllers/ActionlogController.php index f2580c96fc..057ca465bc 100644 --- a/app/Http/Controllers/ActionlogController.php +++ b/app/Http/Controllers/ActionlogController.php @@ -40,10 +40,13 @@ class ActionlogController extends Controller public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse { $this->authorize('view', \App\Models\Asset::class); - $file = config('app.private_uploads').'/eula-pdfs/'.$filename; + + if (config('filesystems.default') == 's3_private') { + return redirect()->away(Storage::disk('s3_private')->temporaryUrl('private_uploads/eula-pdfs/'.$filename, now()->addMinutes(5))); + } if (Storage::exists('private_uploads/eula-pdfs/'.$filename)) { - return response()->download($file); + return response()->download(config('app.private_uploads').'/eula-pdfs/'.$filename); } return redirect()->back()->with('error', trans('general.file_does_not_exist')); From 27a7a89990d35173086ed4cbf9787a1b290dfc2e Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 15:06:00 +0000 Subject: [PATCH 2/8] Updated bootstrap tables to 1.24.0 Signed-off-by: snipe --- package-lock.json | 8 ++++---- package.json | 2 +- public/css/dist/all.css | Bin 493628 -> 493628 bytes public/css/dist/bootstrap-table.css | Bin 12904 -> 12904 bytes public/js/dist/bootstrap-table-en-US.min.js | Bin 19018 -> 19018 bytes .../js/dist/bootstrap-table-locale-all.min.js | Bin 146094 -> 146094 bytes public/js/dist/bootstrap-table.js | Bin 2105599 -> 2107521 bytes public/mix-manifest.json | 10 +++++----- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4be77b4eaf..7de7aaea76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "bootstrap-colorpicker": "^2.5.3", "bootstrap-datepicker": "^1.10.0", "bootstrap-less": "^3.3.8", - "bootstrap-table": "1.23.5", + "bootstrap-table": "1.24.0", "canvas-confetti": "^1.9.3", "chart.js": "^2.9.4", "clipboard": "^2.0.11", @@ -3705,9 +3705,9 @@ "license": "MIT" }, "node_modules/bootstrap-table": { - "version": "1.23.5", - "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.23.5.tgz", - "integrity": "sha512-9WByoSpJvA73gi2YYIlX6IWR74oZtBmSixul/Th8FTBtBd/kZRpbKESGTjhA3BA3AYTnfyY8Iy1KeRWPlV2GWQ==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.24.0.tgz", + "integrity": "sha512-dyRf5PQwTgFHj9yjuPXa+GIf4JpuQhsgD1CJrOqhw40qI2gTb3mJfRdoBc7iF2bqzOl+k0RnbAlhSPbGe4VS+w==", "peerDependencies": { "jquery": "3" } diff --git a/package.json b/package.json index 180c0655c2..e86bf90660 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "bootstrap-colorpicker": "^2.5.3", "bootstrap-datepicker": "^1.10.0", "bootstrap-less": "^3.3.8", - "bootstrap-table": "1.23.5", + "bootstrap-table": "1.24.0", "canvas-confetti": "^1.9.3", "chart.js": "^2.9.4", "clipboard": "^2.0.11", diff --git a/public/css/dist/all.css b/public/css/dist/all.css index f6a43f59117a41027489d0b12487c6bf17ae45a8..848587ae704d06737783d1bfb43889eb49fc819f 100644 GIT binary patch delta 40 wcmdlpL2l0kxrP?T7N!>F7M2#)Eo_#a%qDsU(;d{<#M^^C*|rCJvcI$g01-9}jQ{`u delta 40 wcmdlpL2l0kxrP?T7N!>F7M2#)Eo_#a%*J}A(;d{<#M^^C*|rCJvcI$g01Ba~FBLFc|1!4dI diff --git a/public/js/dist/bootstrap-table-en-US.min.js b/public/js/dist/bootstrap-table-en-US.min.js index 43614925731ffa9555b4e07c9868f6e2f7e03e0e..a0e92322cffd3b1273a2678482facd2117de28c7 100644 GIT binary patch delta 33 ncmX>#h4IuB#tA2wP4o;lo?b4@Y^i53xm2VLL~s5l;$sQ`+e8cg delta 33 ncmX>#h4IuB#tA2wjrB}7o?b4@Y@ug3xm2VLL~s5l;$sQ`+m;Lh diff --git a/public/js/dist/bootstrap-table-locale-all.min.js b/public/js/dist/bootstrap-table-locale-all.min.js index 760f77ba819698983822a09c66510308d6b8ef25..b555f75846e9270166fff6dc572da798e5fe9570 100644 GIT binary patch delta 313 zcmV-90mlBW^$4!@2$0AFG%hf)%cm0qIW91hbrgmJIW91>{uJXlvm{t12(xi}FbT7u zXxj&~p@fSFmu^e}2DkY{0h$Ms4wVO!GxR63S&iEVvwLv%3X^cC1hY7m@CTFrR|m7` zO*{&-D4k*xvuwEh2eXQ>;0Lo4$o2=bX27invkB1C2eZrI%m=gF*Y60km*`tux5`uj z5D2%EOaV6tvr1rA2)Ei?0Zs{*Aa?-=x2bLcod~xmW&wH#w?=mXsS3BTkpajGw+)H` zqzAWooBAAR4S8GI$U| zM1n+Q*d;EsG(|!m36Xw~eFnD_N=MD6GoDn1QWe_HnB7iK`X*^Jd!4S>vVG%UuGzo5 ztnCb|{4w4|vaW-lxNrIu*|%C%8U32V*11jM!7vf`M}LtQ<1;pXkay(VX$@mqwuw)! zlgR1IDzcuhZ+V9Z{3NO_?# zOV2DMNPJ;9QpH_>b`sfw1WIWQGO7f2!Ai1}1eZl37r?5_#{n(kx`GH9N&zgf!;nM1 z^DwFy`}szAeg`%(noFR_WD%ZF3RSo#@s!{gB~^zZlEfK2qeQKya*LGFw5Q5Sr>VE? E5B4B`%m4rY diff --git a/public/js/dist/bootstrap-table.js b/public/js/dist/bootstrap-table.js index a48e93b6349a4d1a5a00e6765630bd34375e8027..608f3007332c79bb5f34af27b7eba131a297ea83 100644 GIT binary patch delta 3677 zcmc&#e{2)?71#Ohd;W3fABjV79NRhPmlJRtCvnPB2nh;h?YcrV)~+iH!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+L41S6wp&i^y&{&}fW-URZl%}v6 zYIo0rZi8%tHA~RVD8m6Eopwt%l1&+Uo;TK!XdT-G`@H-nEM2Hj+sAxe=!_A&76ju9 z%R0lM2VKm&0&Uh^$$_og4Mi|80}-HaN-`_zMWw=(8`xbd(T*^?^Bh`ZgYmb?Mpm!L z2W|nR17KaZ|;b`0zrR;02ht)r?p7LTe?wJR2)H*sG*G!uvBay+DV z#3QtVmhvEjPsuJJ4#|{(nbOTt!uvPa(WaKblsj}IDE(oLmhD9R7PbaWLJDYP7FVJxvzI9R_O!$cp#kwJ-lntK5?KaqW0q4TL$+E(R zf5dq@#_3aLIAb6su=@*Sfu&mvCb+{$s$tMb9PmU^w!r+OxY*GeUbrw6p$npI9qo|> z|3@DPhl*Vum}(?8=rj@wyoF>v+=j`b%g5NSm>frNUlutFzf6#``eGF_)Qv}@*+4d# zA(&gDQI!`=Fm`var7Z-$Pox}n!A2Udk<79a$IJ&pU750SUG&10uD?r6&BJM$gI9|Z z(YShNJRFUO)h?HtKFk{toOY7Ow%N(c0w~QUCzMg5XNw)gC8U%0Tpk&j{tp$9Y}l1Y z>@a>iwnD0anA2<_pOk4FOFof_o0qrC#d|z`ceCU^`D0wmF~-1VitUm1d3+92O2MM;1pm zhm9kL!_JY*;o!*Q$mbZzj;t)`U-bV>>kkcJikb9mPn9zwUYeSRBsPA!bJGn!T)-bL Q8+&}FbJxEZpc}sW6IoqlJ^%m! diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 3160379223..08bf9cdbfc 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -19,7 +19,7 @@ "/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=f677207c6cf9678eb539abecb408c374", "/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=6ea836d8126de101081c49abbdb89417", "/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=76482123f6c70e866d6b971ba91de7bb", - "/css/dist/all.css": "/css/dist/all.css?id=c16aa8b273e295ae741b018af6e3e05c", + "/css/dist/all.css": "/css/dist/all.css?id=18ebb9c284b49dcf6c8e4fdb923ad923", "/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde", @@ -90,8 +90,8 @@ "/css/webfonts/fa-solid-900.woff2": "/css/webfonts/fa-solid-900.woff2?id=109ad919b74a62a8a223361da1651bbc", "/css/webfonts/fa-v4compatibility.ttf": "/css/webfonts/fa-v4compatibility.ttf?id=53c2e50ef821f7b8dd514611d5e0772c", "/css/webfonts/fa-v4compatibility.woff2": "/css/webfonts/fa-v4compatibility.woff2?id=331c85bd61ffa93af09273d1bc2add5a", - "/js/dist/bootstrap-table-locale-all.min.js": "/js/dist/bootstrap-table-locale-all.min.js?id=c5445e15be5ce91a9ffef05e08ad6898", - "/js/dist/bootstrap-table-en-US.min.js": "/js/dist/bootstrap-table-en-US.min.js?id=0f6e85ae692d03a3b11cab445ff263ab", + "/js/dist/bootstrap-table-locale-all.min.js": "/js/dist/bootstrap-table-locale-all.min.js?id=02dfc50d5b951dc6d260bd508968d319", + "/js/dist/bootstrap-table-en-US.min.js": "/js/dist/bootstrap-table-en-US.min.js?id=1c350eabf064c309f67d6779e5cc4afa", "/css/dist/skins/_all-skins.min.css": "/css/dist/skins/_all-skins.min.css?id=e71ef4171dee5da63af390966ac60ffc", "/css/dist/skins/skin-black-dark.min.css": "/css/dist/skins/skin-black-dark.min.css?id=06c13e817cc022028b3f4a33c0ca303a", "/css/dist/skins/skin-black.min.css": "/css/dist/skins/skin-black.min.css?id=76482123f6c70e866d6b971ba91de7bb", @@ -108,8 +108,8 @@ "/css/dist/skins/skin-red.min.css": "/css/dist/skins/skin-red.min.css?id=44bf834f2110504a793dadec132a5898", "/css/dist/skins/skin-yellow-dark.min.css": "/css/dist/skins/skin-yellow-dark.min.css?id=ea22079836a432d7f46a5d390c445e13", "/css/dist/skins/skin-yellow.min.css": "/css/dist/skins/skin-yellow.min.css?id=7b315b9612b8fde8f9c5b0ddb6bba690", - "/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=c384582a6ba08903af353be861ffe74e", + "/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=ceded08e0cc745a83c13647035b03406", "/js/build/vendor.js": "/js/build/vendor.js?id=89dffa552c6e3abe3a2aac6c9c7b466b", - "/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=b4c3069f1a292527a96c058b77b28d69", + "/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=61285c8ac5ea7b46002ea8c451c94e60", "/js/dist/all.js": "/js/dist/all.js?id=eeeac92878ac0b207ad7f39d593f62c3" } From 4fe83467ee0905405366644df0045935feef98a2 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 16:20:31 +0000 Subject: [PATCH 3/8] Removed log error Signed-off-by: snipe --- tests/Feature/Importing/Ui/ImportTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Feature/Importing/Ui/ImportTest.php b/tests/Feature/Importing/Ui/ImportTest.php index 4b811c4872..2caaa4c097 100644 --- a/tests/Feature/Importing/Ui/ImportTest.php +++ b/tests/Feature/Importing/Ui/ImportTest.php @@ -43,7 +43,6 @@ class ImportTest extends TestCase ] ] ]); - \Log::error(print_r($results, true)); $this->assertEquals($evil_string, $results->json()['files'][0]['first_row'][0]); } } From 801328ec42d5844bbf924bb80408cc89e98c801b Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 16:23:13 +0000 Subject: [PATCH 4/8] Fixed #16097 - allow location update by ID in importer Signed-off-by: snipe --- app/Importer/Importer.php | 1 + app/Importer/ItemImporter.php | 3 +-- app/Importer/LocationImporter.php | 9 ++++++++- app/Livewire/Importer.php | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Importer/Importer.php b/app/Importer/Importer.php index 907c8b72c5..0d4b8d4932 100644 --- a/app/Importer/Importer.php +++ b/app/Importer/Importer.php @@ -39,6 +39,7 @@ abstract class Importer * @var array */ private $defaultFieldMap = [ + 'id' => 'id', 'asset_tag' => 'asset tag', 'activated' => 'activated', 'category' => 'category', diff --git a/app/Importer/ItemImporter.php b/app/Importer/ItemImporter.php index 6b1d647136..435f081aba 100644 --- a/app/Importer/ItemImporter.php +++ b/app/Importer/ItemImporter.php @@ -456,14 +456,13 @@ class ItemImporter extends Importer { if (empty($asset_location)) { $this->log('No location given, so none created.'); - return null; } + $location = Location::where(['name' => $asset_location])->first(); if ($location) { $this->log('Location '.$asset_location.' already exists'); - return $location->id; } // No matching locations in the collection, create a new one. diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php index a9a5152234..b875d66c6a 100644 --- a/app/Importer/LocationImporter.php +++ b/app/Importer/LocationImporter.php @@ -38,7 +38,14 @@ class LocationImporter extends ItemImporter { $editingLocation = false; - $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); + + if ($this->findCsvMatch($row, 'id')) { + $location = Location::find($this->findCsvMatch($row, 'id')); + } else { + $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); + } + + if ($location) { if (! $this->updating) { diff --git a/app/Livewire/Importer.php b/app/Livewire/Importer.php index 75b707b8ad..aee6b852d4 100644 --- a/app/Livewire/Importer.php +++ b/app/Livewire/Importer.php @@ -329,6 +329,7 @@ class Importer extends Component ]; $this->locations_fields = [ + 'id' => trans('general.id'), 'name' => trans('general.item_name_var', ['item' => trans('general.location')]), 'address' => trans('general.address'), 'address2' => trans('general.importer.address2'), @@ -400,7 +401,6 @@ class Importer extends Component 'requestable', 'Requestable', ], - 'gravatar' => [ 'gravatar', From 48a916ab775f910c8ad02367d0ef4cf0db6b18f3 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 16:38:31 +0000 Subject: [PATCH 5/8] Check that the ID has a value Signed-off-by: snipe --- app/Importer/LocationImporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php index b875d66c6a..58db51affa 100644 --- a/app/Importer/LocationImporter.php +++ b/app/Importer/LocationImporter.php @@ -39,7 +39,7 @@ class LocationImporter extends ItemImporter $editingLocation = false; - if ($this->findCsvMatch($row, 'id')) { + if ($this->findCsvMatch($row, 'id')!='') { $location = Location::find($this->findCsvMatch($row, 'id')); } else { $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); From 0a5c41ce23e4d6658ed1dae9a884b35b84d80623 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 16:42:53 +0000 Subject: [PATCH 6/8] Log error Signed-off-by: snipe --- app/Importer/LocationImporter.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php index 58db51affa..36c909ba8b 100644 --- a/app/Importer/LocationImporter.php +++ b/app/Importer/LocationImporter.php @@ -103,6 +103,7 @@ class LocationImporter extends ItemImporter } else { Log::debug($location->getErrors()); return $location->errors; + $this->logError($location, 'Location "'.$this->item['name'].'"'); } From 713c9fdd6f6d39aaa97c3518fb032361ee899e94 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 16:46:22 +0000 Subject: [PATCH 7/8] Derp Signed-off-by: snipe --- app/Importer/LocationImporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php index 36c909ba8b..7005834767 100644 --- a/app/Importer/LocationImporter.php +++ b/app/Importer/LocationImporter.php @@ -102,8 +102,8 @@ class LocationImporter extends ItemImporter } else { Log::debug($location->getErrors()); - return $location->errors; $this->logError($location, 'Location "'.$this->item['name'].'"'); + return $location->errors; } From 52734086314f78347cb4e639eb610b2ad9589643 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 16:53:48 +0000 Subject: [PATCH 8/8] Check for matching ID Signed-off-by: snipe --- app/Importer/LocationImporter.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php index 7005834767..5a87d069e5 100644 --- a/app/Importer/LocationImporter.php +++ b/app/Importer/LocationImporter.php @@ -39,12 +39,13 @@ class LocationImporter extends ItemImporter $editingLocation = false; - if ($this->findCsvMatch($row, 'id')!='') { - $location = Location::find($this->findCsvMatch($row, 'id')); - } else { - $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); - } + $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); + if ($this->findCsvMatch($row, 'id')!='') { + // Override location if an ID was given + \Log::debug('Finding location by ID: '.$this->findCsvMatch($row, 'id')); + $location = Location::find($this->findCsvMatch($row, 'id')); + } if ($location) {