mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Fix for when a user with the correct permissions couldn't update Manufacturers. (#7882)
* Changed the ability name from 'edit' to 'update'. Changed the order of execution: first checks if the manufacturer exists, then checks permissions
* Handles the update method, that also has the ability parameter as edit instead of update"
q
* Revert "Handles the update method, that also has the ability parameter as edit instead of update""
This reverts commit d7dc0e451e
.
* Handles the update method, that also has the ability parameter as 'edit' instead of 'update'
This commit is contained in:
parent
54fd8f81ff
commit
025ea93f05
|
@ -96,11 +96,13 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function edit($id = null)
|
||||
{
|
||||
$this->authorize('edit', Manufacturer::class);
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($item = Manufacturer::find($id))) {
|
||||
if (!$item = Manufacturer::find($id)) {
|
||||
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||
}
|
||||
//Handles manufacturer checks and permissions.
|
||||
$this->authorize('update', Manufacturer::class);
|
||||
|
||||
// Show the page
|
||||
return view('manufacturers/edit', compact('item'));
|
||||
}
|
||||
|
@ -118,7 +120,7 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function update(ImageUploadRequest $request, $manufacturerId = null)
|
||||
{
|
||||
$this->authorize('edit', Manufacturer::class);
|
||||
$this->authorize('update', Manufacturer::class);
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||
// Redirect to the manufacturer page
|
||||
|
|
Loading…
Reference in a new issue