Update dump with new migration.

This commit is contained in:
Daniel Meltzer 2016-12-29 12:04:28 -05:00
parent aa2d3cf026
commit 62dd474d44
4 changed files with 28 additions and 9 deletions

View file

@ -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);

View file

@ -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

View file

@ -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.
}