-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Logging Audit on Checkin/out #16679
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
base: develop
Are you sure you want to change the base?
Logging Audit on Checkin/out #16679
Changes from all commits
be0fdb3
26aa3ee
0b288ed
02357a8
1943bcd
6617fa9
cc686b1
2b54fbb
802f03e
6f2d314
4cad217
e9be4ef
ea94123
05cd73d
76da4b5
7ab522e
5967b8b
af6cdce
24fb9ff
9c6eeab
e77e57e
1095da0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| use Illuminate\Support\Facades\Session; | ||
| use \Illuminate\Contracts\View\View; | ||
| use \Illuminate\Http\RedirectResponse; | ||
| use Gate; | ||
| use Illuminate\Support\Facades\Validator; | ||
|
|
||
| class AssetCheckoutController extends Controller | ||
|
|
@@ -44,7 +45,7 @@ public function create(Asset $asset) : View | RedirectResponse | |
| return redirect()->route('hardware.edit', $asset)->withErrors($asset->getErrors()); | ||
| } | ||
|
|
||
|
|
||
| if ($asset->availableForCheckout()) { | ||
| return view('hardware/checkout', compact('asset')) | ||
| ->with('statusLabel_list', Helper::deployableStatusLabelList()) | ||
|
|
@@ -80,6 +81,12 @@ public function store(AssetCheckoutRequest $request, $assetId) : RedirectRespons | |
|
|
||
| $admin = auth()->user(); | ||
|
|
||
| if(Gate::allows('audit',$asset)) { | ||
| if ($request->filled('log_audit') == "1") { | ||
| $this->authorize('audit', Asset::class); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here |
||
| } | ||
| } | ||
|
|
||
| $target = $this->determineCheckoutTarget(); | ||
|
|
||
| $asset = $this->updateAssetLocation($asset, $target); | ||
|
|
@@ -123,7 +130,14 @@ public function store(AssetCheckoutRequest $request, $assetId) : RedirectRespons | |
| session()->put(['redirect_option' => $request->get('redirect_option'), 'checkout_to_type' => $request->get('checkout_to_type')]); | ||
|
|
||
| if ($asset->checkOut($target, $admin, $checkout_at, $expected_checkin, $request->get('note'), $request->get('name'))) { | ||
| return Helper::getRedirectOption($request, $asset->id, 'Assets') | ||
|
|
||
| if(Gate::allows('audit',$asset)) { | ||
| if ($request->filled('log_audit') == "1") { | ||
| $asset->logAudit($request->input('note'), $request->input('location_id')); | ||
| } | ||
| } | ||
| return redirect()->to(Helper::getRedirectOption($request, $asset->id, 'Assets')) | ||
|
|
||
| ->with('success', trans('admin/hardware/message.checkout.success')); | ||
| } | ||
| // Redirect to the asset management page with error | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -291,6 +291,8 @@ | |
| 'require_accept_signature_help_text' => 'Enabling this feature will require users to physically sign off on accepting an asset.', | ||
| 'require_checkinout_notes' => 'Require Notes on Checkin/Checkout', | ||
| 'require_checkinout_notes_help_text' => 'Enabling this feature will require the note fields to be populated when checking in or checking out an asset.', | ||
| 'log_audit' => 'Mark as audited', | ||
| 'log_audit_help_text' => 'Check this box to also log an audit in addition to this', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This phrasing seems a little clunky to me.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does, but words are not my strong suit. example:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my example in the PR review comment. I suggested different phrasing altogether :) |
||
| 'left' => 'left', | ||
| 'right' => 'right', | ||
| 'top' => 'top', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause a forbidden error. We don't need the entire block in this section.