Compare commits

...

25 Commits

Author SHA1 Message Date
snipe f88fee0f21 Make user notes field editable via API 2019-02-12 23:58:30 -08:00
snipe c0669150fb Bumped point version 2019-02-12 23:48:31 -08:00
snipe f3c12f38b6 Fixed #6061 - Assigned user group cannot be removed
This bug was a result of attempting to check if the groups field had a value, and only THEN trying to sync the groups. This meant that uf you were removing ALL groups, the  sync wouldn’t be triggered.

This still needs to be updated in the API.
2019-02-12 23:43:38 -08:00
snipe 5e19178a30 Do not count deleted locations in managedLocation check on user delete 2019-02-12 23:32:10 -08:00
snipe 90cddb7aee Fixed #6113 - use $asset->fill vs filled() to allow blanking values via API (#6693)
Need to confirm that re-enabling `\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,` won’t mangle anything. I know we ran into some issues when testing a long time ago, but not sure those issues apply anymore, and I can’t remember what they were.
2019-02-12 22:08:38 -08:00
snipe 6d828964be Merge branch 'master' of https://github.com/snipe/snipe-it 2019-02-04 18:58:32 -08:00
snipe 971fcf5800 Fixed #6633 - return 200 status code 2019-02-04 18:58:28 -08:00
Daniel Ruf 2ad270cf33 ci: fix indentation (#6669) 2019-01-30 15:14:17 -08:00
Daniel Ruf 8ce78c6b31 tests: allow to fail on PHP 7.3 and use the latest PHP 7.1 release (#6666) 2019-01-30 14:32:33 -08:00
Daniel Ruf af3c8195af tests: fix expected string (#6665) 2019-01-30 14:12:20 -08:00
snipe 117b4c59cc Bumped minor version 2019-01-25 21:06:08 -08:00
snipe 194d0733d4 Fixed #6644 - asset name not linked in Reports > Asset Maintenance Report
This report will likely be deprecated.
2019-01-25 20:57:14 -08:00
snipe a371e8d53f Added calibration as a maintenance type
Should just make these custmizable options
2019-01-24 15:17:33 -08:00
snipe 8f09cca043 Fixed incorrect group route 2019-01-24 15:17:11 -08:00
snipe 39bca49e8f Specify table name in deleted user display 2019-01-24 14:38:18 -08:00
snipe b8269020ae Specify table name in deleted user display 2019-01-24 14:37:39 -08:00
snipe 601c129bbf Embed images in emails 2019-01-17 20:45:24 -08:00
snipe b293d00699 Switch LDAP error to debug, to avoid crapping up the logs 2019-01-17 20:18:03 -08:00
snipe 75a0cf97e2 Return an error if asset maintenance is associated with a non-existant asset 2019-01-16 02:19:57 -08:00
snipe c055e3af21 Only try to return the asset tag link if a valid asset id has been passed 2019-01-16 02:19:35 -08:00
snipe a1f93e733c Fixed undefined error when maintenance is associated with a deleted asset 2019-01-16 01:45:51 -08:00
fanta8897 49073742b5 Updating LDAP such that each user is not required to be bindable to LDAP (#6571)
* Update Ldap.php

* Update Ldap.php

* Update Ldap.php

* Update Ldap.php

* Update Ldap.php

Updating LDAP.php such that the admin bind will ONLY occur if the user attempting auth cannot bind. If that is the case, it will attempt to bind as admin and search for that user, prior to failing.
2019-01-15 14:04:21 -08:00
Sxderp 187206cb88 Fix saving of REMOTE_USER setting broken by 1a64879b6 (#6565)
The previous commit made it such that remote user login could only
be enabled if two factor authentication was also enabled. Unnest
the configuration so that the setting can be applied without.
2019-01-15 13:59:36 -08:00
Hubert 8420cb7ec1 Fixed problem with import when using snipeit:import command (#6550) 2019-01-15 13:58:23 -08:00
Andrey Bolonin 75252bce05 add php 7.3 (#6556) 2019-01-10 13:21:04 -08:00
21 changed files with 116 additions and 70 deletions
+7 -2
View File
@@ -16,8 +16,13 @@ services:
php:
- 5.6
- 7.0
- 7.2
- 7.1.4
- 7.1
- 7.2
- 7.3
matrix:
allow_failures:
- php: 7.3
# execute any number of scripts before the test run, custom env's are available as variables
before_script:
+10 -38
View File
@@ -291,7 +291,7 @@ class AssetsController extends Controller
$this->authorize('view', $asset);
return (new AssetsTransformer)->transformAsset($asset);
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 404);
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
}
@@ -310,7 +310,7 @@ class AssetsController extends Controller
$this->authorize('view', $assets);
return (new AssetsTransformer)->transformAssets($assets, $assets->count());
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 404);
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
}
@@ -468,43 +468,15 @@ class AssetsController extends Controller
$this->authorize('update', Asset::class);
if ($asset = Asset::find($id)) {
($request->has('model_id')) ?
$asset->model()->associate(AssetModel::find($request->get('model_id'))) : '';
($request->has('name')) ?
$asset->name = $request->get('name') : '';
($request->has('serial')) ?
$asset->serial = $request->get('serial') : '';
($request->has('model_id')) ?
$asset->model_id = $request->get('model_id') : '';
($request->has('order_number')) ?
$asset->order_number = $request->get('order_number') : '';
($request->has('notes')) ?
$asset->notes = $request->get('notes') : '';
($request->has('asset_tag')) ?
$asset->asset_tag = $request->get('asset_tag') : '';
($request->has('archived')) ?
$asset->archived = $request->get('archived') : '';
($request->has('status_id')) ?
$asset->status_id = $request->get('status_id') : '';
($request->has('warranty_months')) ?
$asset->warranty_months = $request->get('warranty_months') : '';
($request->has('purchase_cost')) ?
$asset->purchase_cost = Helper::ParseFloat($request->get('purchase_cost')) : '';
($request->has('purchase_date')) ?
$asset->purchase_date = $request->get('purchase_date') : '';
($request->has('assigned_to')) ?
$asset->assigned_to = $request->get('assigned_to') : '';
($request->has('supplier_id')) ?
$asset->supplier_id = $request->get('supplier_id') : '';
($request->has('requestable')) ?
$asset->requestable = $request->get('requestable') : '';
($request->has('rtd_location_id')) ?
$asset->rtd_location_id = $request->get('rtd_location_id') : '';
($request->has('rtd_location_id')) ?
$asset->location_id = $request->get('rtd_location_id') : '';
($request->has('company_id')) ?
$asset->company_id = Company::getIdForCurrentUser($request->get('company_id')) : '';
$asset->fill($request->all());
($request->has('model_id')) ?
$asset->model()->associate(AssetModel::find($request->get('model_id'))) : null;
($request->has('company_id')) ?
$asset->company_id = Company::getIdForCurrentUser($request->get('company_id')) : null;
($request->has('rtd_location_id')) ?
$asset->location_id = $request->get('rtd_location_id') : null;
// Update custom fields
if (($model = AssetModel::find($asset->model_id)) && (isset($model->fieldset))) {
@@ -162,6 +162,9 @@ class AssetMaintenancesController extends Controller
// Redirect to the improvement management page
return redirect()->route('maintenances.index')
->with('error', trans('admin/asset_maintenances/message.not_found'));
} elseif (!$assetMaintenance->asset) {
return redirect()->route('maintenances.index')
->with('error', 'The asset associated with this maintenance does not exist.');
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
@@ -80,7 +80,7 @@ class LoginController extends Controller
Log::debug("Remote user auth lookup complete");
if(!is_null($user)) Auth::login($user, true);
} catch(Exception $e) {
Log::error("There was an error authenticating the Remote user: " . $e->getMessage());
Log::debug("There was an error authenticating the Remote user: " . $e->getMessage());
}
}
}
@@ -169,7 +169,7 @@ class LoginController extends Controller
// If the user was unable to login via LDAP, log the error and let them fall through to
// local authentication.
} catch (\Exception $e) {
Log::error("There was an error authenticating the LDAP user: ".$e->getMessage());
Log::debug("There was an error authenticating the LDAP user: ".$e->getMessage());
}
}
+3 -3
View File
@@ -72,7 +72,7 @@ class GroupsController extends Controller
if ($group->save()) {
return redirect()->route("groups.index")->with('success', trans('admin/groups/message.success.create'));
}
return redirect(route('groups.create'))->withInput()->withErrors($group->getErrors());
return redirect()->back()->withInput()->withErrors($group->getErrors());
}
/**
@@ -111,7 +111,7 @@ class GroupsController extends Controller
{
$permissions = config('permissions');
if (!$group = Group::find($id)) {
return redirect()->route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
}
$group->name = e(Input::get('name'));
$group->permissions = json_encode(Input::get('permission'));
@@ -138,7 +138,7 @@ class GroupsController extends Controller
{
if (!config('app.lock_passwords')) {
if (!$group = Group::find($id)) {
return redirect()->route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
}
$group->delete();
// Redirect to the group management page
+4 -5
View File
@@ -482,13 +482,12 @@ class SettingsController extends Controller
$setting->two_factor_enabled = null;
} else {
$setting->two_factor_enabled = $request->input('two_factor_enabled');
# remote user login
$setting->login_remote_user_enabled = (int)$request->input('login_remote_user_enabled');
$setting->login_common_disabled= (int)$request->input('login_common_disabled');
$setting->login_remote_user_custom_logout_url = $request->input('login_remote_user_custom_logout_url');
}
# remote user login
$setting->login_remote_user_enabled = (int)$request->input('login_remote_user_enabled');
$setting->login_common_disabled = (int)$request->input('login_common_disabled');
$setting->login_remote_user_custom_logout_url = $request->input('login_remote_user_custom_logout_url');
}
$setting->pwd_secure_uncommon = (int) $request->input('pwd_secure_uncommon');
+1 -3
View File
@@ -259,9 +259,7 @@ class UsersController extends Controller
// Only save groups if the user is a super user
if (Auth::user()->isSuperUser()) {
if ($request->has('groups')) {
$user->groups()->sync($request->input('groups'));
}
$user->groups()->sync($request->input('groups'));
}
+1 -1
View File
@@ -25,7 +25,7 @@ class Kernel extends HttpKernel
\Fideloper\Proxy\TrustProxies::class,
\App\Http\Middleware\CheckForSetup::class,
\App\Http\Middleware\CheckForDebug::class,
// \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
@@ -28,7 +28,7 @@ class AssetMaintenancesTransformer
'asset_tag'=> e($assetmaintenance->asset->asset_tag)
] : null,
'company' => (($assetmaintenance->asset->company) && ($assetmaintenance->asset)) ? [
'company' => (($assetmaintenance->asset) && ($assetmaintenance->asset->company)) ? [
'id' => (int) $assetmaintenance->asset->company->id,
'name'=> ($assetmaintenance->asset->company->name) ? e($assetmaintenance->asset->company->name) : null,
+2
View File
@@ -72,6 +72,8 @@ class AssetMaintenance extends Model implements ICompanyableChild
trans('admin/asset_maintenances/general.repair') => trans('admin/asset_maintenances/general.repair'),
trans('admin/asset_maintenances/general.upgrade') => trans('admin/asset_maintenances/general.upgrade'),
'PAT test' => 'PAT test',
trans('admin/asset_maintenances/general.calibration') => trans('admin/asset_maintenances/general.calibration'),
'PAT test' => 'PAT test',
];
}
+4 -1
View File
@@ -96,8 +96,11 @@ class Ldap extends Model
$filterQuery = $settings->ldap_auth_filter_query . $username;
if (!$ldapbind = @ldap_bind($connection, $userDn, $password)) {
return false;
if(!$ldapbind = Ldap::bindAdminToLdap($connection)){
return false;
}
}
if (!$results = ldap_search($connection, $baseDn, $filterQuery)) {
+2 -1
View File
@@ -41,7 +41,8 @@ trait Loggable
$settings = Setting::getSettings();
$log = new Actionlog;
$log = $this->determineLogItemType($log);
$log->user_id = Auth::user()->id;
if(Auth::user())
$log->user_id = Auth::user()->id;
if (!isset($target)) {
throw new Exception('All checkout logs require a target');
+4 -3
View File
@@ -47,6 +47,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
'manager_id',
'password',
'phone',
'notes',
'state',
'username',
'zip',
@@ -269,7 +270,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
**/
public function managedLocations()
{
return $this->hasMany('\App\Models\Location', 'manager_id')->withTrashed();
return $this->hasMany('\App\Models\Location', 'manager_id');
}
/**
@@ -328,7 +329,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
public function scopeGetDeleted($query)
{
return $query->withTrashed()->whereNotNull('deleted_at');
return $query->withTrashed()->whereNotNull('users.deleted_at');
}
public function scopeGetNotDeleted($query)
@@ -445,7 +446,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
public function scopeDeleted($query)
{
return $query->whereNotNull('deleted_at');
return $query->whereNotNull('users.deleted_at');
}
+1
View File
@@ -12,6 +12,7 @@
"doctrine/dbal": "^2.5.13",
"doctrine/inflector": "1.1.*",
"doctrine/instantiator": "1.0.*",
"eduardokum/laravel-mail-auto-embed": "^1.0",
"erusev/parsedown": "^1.6",
"fideloper/proxy": "^3.3",
"intervention/image": "^2.3",
Generated
+56 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "b575236d6ef1d5f8799acf86ca03bc4e",
"content-hash": "f44697f67c1de6fd46cb9a7cb8bc20a6",
"packages": [
{
"name": "barryvdh/laravel-debugbar",
@@ -729,6 +729,61 @@
],
"time": "2014-09-09T13:34:57+00:00"
},
{
"name": "eduardokum/laravel-mail-auto-embed",
"version": "1.0.4",
"source": {
"type": "git",
"url": "https://github.com/eduardokum/laravel-mail-auto-embed.git",
"reference": "918c3aff220d965fbaee96ae4d48a09036381bdf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/eduardokum/laravel-mail-auto-embed/zipball/918c3aff220d965fbaee96ae4d48a09036381bdf",
"reference": "918c3aff220d965fbaee96ae4d48a09036381bdf",
"shasum": ""
},
"require": {
"illuminate/contracts": ">=5.3",
"illuminate/mail": ">=5.3",
"illuminate/support": ">=5.3",
"php": ">=5.5.0"
},
"require-dev": {
"orchestra/testbench": "~3.0",
"phpunit/phpunit": "~5.0|~6.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Eduardokum\\LaravelMailAutoEmbed\\ServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Eduardokum\\LaravelMailAutoEmbed\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eduardo Gusmão",
"email": "eduguscontra3@hotmail.com"
}
],
"description": "Library for embed images in emails automatically",
"homepage": "https://github.com/eduardokum/laravel-mail-auto-embed",
"keywords": [
"eduardokum",
"laravel-mail-auto-embed"
],
"time": "2017-09-21T12:11:32+00:00"
},
{
"name": "erusev/parsedown",
"version": "1.7.1",
+1
View File
@@ -297,6 +297,7 @@ return [
Unicodeveloper\DumbPassword\DumbPasswordServiceProvider::class,
Schuppo\PasswordStrength\PasswordStrengthServiceProvider::class,
Tightenco\Ziggy\ZiggyServiceProvider::class, // Laravel routes in vue
Eduardokum\LaravelMailAutoEmbed\ServiceProvider::class,
/*
* Application Service Providers...
+5 -5
View File
@@ -1,10 +1,10 @@
<?php
return array (
'app_version' => 'v4.6.7',
'full_app_version' => 'v4.6.7 - build 3944-g8f6ea84fc',
'build_version' => '3944',
'app_version' => 'v4.6.9',
'full_app_version' => 'v4.6.9 - build 3968-gf3c12f38b',
'build_version' => '3968',
'prerelease_version' => '',
'hash_version' => 'g8f6ea84fc',
'full_hash' => 'v4.6.7-15-g8f6ea84fc',
'hash_version' => 'gf3c12f38b',
'full_hash' => 'v4.6.9-8-gf3c12f38b',
'branch' => 'master',
);
@@ -7,5 +7,6 @@
'view' => 'View Asset Maintenance Details',
'repair' => 'Repair',
'maintenance' => 'Maintenance',
'upgrade' => 'Upgrade'
'upgrade' => 'Upgrade',
'calibration' => 'Calibration'
];
@@ -435,7 +435,11 @@
}
function assetTagLinkFormatter(value, row) {
return '<a href="{{ url('/') }}/hardware/' + row.asset.id + '"> ' + row.asset.asset_tag + '</a>';
if ((row.asset) && (row.asset.id)) {
return '<a href="{{ url('/') }}/hardware/' + row.asset.id + '"> ' + row.asset.asset_tag + '</a>';
}
return '';
}
function assetNameLinkFormatter(value, row) {
@@ -37,7 +37,7 @@
<tr>
<th data-field="company" data-sortable="false" data-visible="false">{{ trans('admin/companies/table.title') }}</th>
<th data-sortable="true" data-field="id" data-visible="false">{{ trans('general.id') }}</th>
<th data-sortable="false" data-field="asset_name" data-formatter="hardwareLinkObjFormatter">{{ trans('admin/asset_maintenances/table.asset_name') }}</th>
<th data-sortable="false" data-field="asset_name" data-formatter="assetNameLinkFormatter">{{ trans('admin/asset_maintenances/table.asset_name') }}</th>
<th data-sortable="false" data-field="supplier" data-formatter="suppliersLinkObjFormatter">{{ trans('general.supplier') }}</th>
<th data-searchable="true" data-sortable="true" data-field="asset_maintenance_type">{{ trans('admin/asset_maintenances/form.asset_maintenance_type') }}</th>
<th data-searchable="true" data-sortable="true" data-field="title">{{ trans('admin/asset_maintenances/form.title') }}</th>
+1 -1
View File
@@ -43,7 +43,7 @@ class ConsumablesCest
$I->seeElement('.alert-danger');
$I->see('The name must be at least 3 characters', '.alert-msg');
$I->see('The qty must be at least 0', '.alert-msg');
$I->see('The min amt must be at least 1', '.alert-msg');
$I->see('The min amt must be at least 0', '.alert-msg');
}
public function passesCorrectValidation(FunctionalTester $I)