mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Update dump with new migration.
This commit is contained in:
parent
aa2d3cf026
commit
62dd474d44
|
@ -550,7 +550,7 @@ class UsersController extends Controller
|
|||
*/
|
||||
public function show($userId = null)
|
||||
{
|
||||
if(!$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($userId)) {
|
||||
if(!$user = User::with('assignedAssets', 'assignedAssets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($userId)) {
|
||||
$error = trans('admin/users/message.user_not_found', compact('id'));
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')->with('error', $error);
|
||||
|
|
|
@ -23,7 +23,6 @@ class AssetPolicy
|
|||
|
||||
public function before(User $user, $ability, $asset)
|
||||
{
|
||||
return true;
|
||||
// Lets move all company related checks here.
|
||||
if ($asset instanceof \App\Models\Asset && !Company::isCurrentUserHasAccess($asset)) {
|
||||
return false;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -35,11 +35,30 @@ class AssetsCest
|
|||
{
|
||||
$asset = factory(App\Models\Asset::class,'asset')->make();
|
||||
$values = [
|
||||
'company_id' => $asset->company_id,
|
||||
'asset_tag' => $asset->asset_tag,
|
||||
'model_id' => $asset->model_id,
|
||||
'status_id' => $asset->status_id,
|
||||
'assigned_user' => $I->getUserId(),
|
||||
'serial' => $asset->serial,
|
||||
'name' => $asset->name,
|
||||
'purchase_date' => '2016-01-01',
|
||||
'supplier_id' => $asset->supplier_id,
|
||||
'order_number' => $asset->order_number,
|
||||
'purchase_cost' => $asset->purchase_cost,
|
||||
'warranty_months' => $asset->warranty_months,
|
||||
'notes' => $asset->notes,
|
||||
'rtd_location_id' => $asset->rtd_location_id,
|
||||
'requestable' => $asset->requestable,
|
||||
];
|
||||
|
||||
$seenValues = [
|
||||
'company_id' => $asset->company_id,
|
||||
'asset_tag' => $asset->asset_tag,
|
||||
'model_id' => $asset->model_id,
|
||||
'status_id' => $asset->status_id,
|
||||
'assigned_to' => $I->getUserId(),
|
||||
'assigned_type' => 'App\Models\User',
|
||||
'serial' => $asset->serial,
|
||||
'name' => $asset->name,
|
||||
'purchase_date' => '2016-01-01',
|
||||
|
@ -55,7 +74,7 @@ class AssetsCest
|
|||
$I->wantTo("Test Validation Succeeds");
|
||||
$I->amOnPage(route('hardware.create'));
|
||||
$I->submitForm('form#create-form', $values);
|
||||
$I->seeRecord('assets', $values);
|
||||
$I->seeRecord('assets', $seenValues);
|
||||
$I->dontSeeElement('.alert-danger'); // We should check for success, but we can't because of the stupid ajaxy way I did things. FIXME when the asset form is rewritten.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue