diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php
index aba23151aa..2928f38186 100755
--- a/app/Console/Commands/LdapSync.php
+++ b/app/Console/Commands/LdapSync.php
@@ -84,7 +84,7 @@ class LdapSync extends Command
}
/* Determine which location to assign users to by default. */
- $location = NULL;
+ $location = NULL; // FIXME - this would be better called "$default_location", which is more explicit about its purpose
if ($this->option('location')!='') {
$location = Location::where('name', '=', $this->option('location'))->first();
@@ -106,8 +106,8 @@ class LdapSync extends Command
$ldap_ou_locations = Location::where('ldap_ou', '!=', '')->get()->toArray();
$ldap_ou_lengths = array();
- foreach ($ldap_ou_locations as $location) {
- $ldap_ou_lengths[] = strlen($location["ldap_ou"]);
+ foreach ($ldap_ou_locations as $ou_loc) {
+ $ldap_ou_lengths[] = strlen($ou_loc["ldap_ou"]);
}
array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations);
diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php
index 6b5874df9b..efa4154e59 100644
--- a/app/Http/Controllers/Api/UsersController.php
+++ b/app/Http/Controllers/Api/UsersController.php
@@ -60,6 +60,7 @@ class UsersController extends Controller
'users.updated_at',
'users.username',
'users.zip',
+ 'users.ldap_import',
])->with('manager', 'groups', 'userloc', 'company', 'department','assets','licenses','accessories','consumables')
->withCount('assets as assets_count','licenses as licenses_count','accessories as accessories_count','consumables as consumables_count');
@@ -131,7 +132,7 @@ class UsersController extends Controller
'assets','accessories', 'consumables','licenses','groups','activated','created_at',
'two_factor_enrolled','two_factor_optin','last_login', 'assets_count', 'licenses_count',
'consumables_count', 'accessories_count', 'phone', 'address', 'city', 'state',
- 'country', 'zip', 'id'
+ 'country', 'zip', 'id', 'ldap_import'
];
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name';
diff --git a/app/Http/Requests/ImageUploadRequest.php b/app/Http/Requests/ImageUploadRequest.php
index 2b43f9194d..f7b1a05256 100644
--- a/app/Http/Requests/ImageUploadRequest.php
+++ b/app/Http/Requests/ImageUploadRequest.php
@@ -27,7 +27,7 @@ class ImageUploadRequest extends Request
public function rules()
{
return [
- 'image' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml',
+ 'image' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp',
'avatar' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml',
];
}
@@ -91,8 +91,8 @@ class ImageUploadRequest extends Request
\Log::info('File name will be: '.$file_name);
\Log::debug('File extension is: '. $ext);
- if ($image->getClientOriginalExtension()!=='svg') {
- \Log::debug('Not an SVG - resize');
+ if (($image->getClientOriginalExtension()!=='webp') && ($image->getClientOriginalExtension()!=='svg')) {
+ \Log::debug('Not an SVG or webp - resize');
\Log::debug('Trying to upload to: '.$path.'/'.$file_name);
$upload = Image::make($image->getRealPath())->resize(null, $w, function ($constraint) {
$constraint->aspectRatio();
@@ -102,20 +102,27 @@ class ImageUploadRequest extends Request
// This requires a string instead of an object, so we use ($string)
Storage::disk('public')->put($path.'/'.$file_name, (string)$upload->encode());
-
- // If the file is an SVG, we need to clean it and NOT encode it
} else {
- \Log::debug('This is an SVG');
- $sanitizer = new Sanitizer();
- $dirtySVG = file_get_contents($image->getRealPath());
- $cleanSVG = $sanitizer->sanitize($dirtySVG);
+ // If the file is a webp, we need to just move it since webp support
+ // needs to be compiled into gd for resizing to be available
+ if ($image->getClientOriginalExtension()=='webp') {
+ \Log::debug('This is a webp, just move it');
+ Storage::disk('public')->put($path.'/'.$file_name, file_get_contents($image));
+ // If the file is an SVG, we need to clean it and NOT encode it
+ } else {
- try {
- \Log::debug('Trying to upload to: '.$path.'/'.$file_name);
- Storage::disk('public')->put($path.'/'.$file_name, $cleanSVG);
- } catch (\Exception $e) {
- \Log::debug('Upload no workie :( ');
- \Log::debug($e);
+ \Log::debug('This is an SVG');
+ $sanitizer = new Sanitizer();
+ $dirtySVG = file_get_contents($image->getRealPath());
+ $cleanSVG = $sanitizer->sanitize($dirtySVG);
+
+ try {
+ \Log::debug('Trying to upload to: '.$path.'/'.$file_name);
+ Storage::disk('public')->put($path.'/'.$file_name, $cleanSVG);
+ } catch (\Exception $e) {
+ \Log::debug('Upload no workie :( ');
+ \Log::debug($e);
+ }
}
}
diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.php
index 9a8b0a098f..2c01582ddd 100644
--- a/app/Http/Transformers/UsersTransformer.php
+++ b/app/Http/Transformers/UsersTransformer.php
@@ -52,6 +52,7 @@ class UsersTransformer
'notes'=> e($user->notes),
'permissions' => $user->decodePermissions(),
'activated' => ($user->activated =='1') ? true : false,
+ 'ldap_import' => ($user->ldap_import =='1') ? true : false,
'two_factor_activated' => ($user->two_factor_active()) ? true : false,
'two_factor_enrolled' => ($user->two_factor_active_and_enrolled()) ? true : false,
'assets_count' => (int) $user->assets_count,
diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php
index 3ab4a80aa6..77d24265fe 100644
--- a/app/Presenters/UserPresenter.php
+++ b/app/Presenters/UserPresenter.php
@@ -225,6 +225,15 @@ class UserPresenter extends Presenter
"visible" => true,
'formatter' => 'groupsFormatter'
],
+ [
+ "field" => "ldap_import",
+ "searchable" => false,
+ "sortable" => true,
+ "switchable" => true,
+ "title" => trans('admin/settings/general.ldap_enabled'),
+ "visible" => false,
+ 'formatter' => 'trueFalseFormatter'
+ ],
[
"field" => "two_factor_enrolled",
"searchable" => false,
diff --git a/app/Services/LdapAd.php b/app/Services/LdapAd.php
index 937507d2d7..85410ce7d1 100644
--- a/app/Services/LdapAd.php
+++ b/app/Services/LdapAd.php
@@ -235,15 +235,20 @@ class LdapAd extends LdapAdConfiguration
$user->employee_num = trim($userInfo['employee_number']);
$user->jobtitle = trim($userInfo['title']);
$user->phone = trim($userInfo['telephonenumber']);
- if(array_key_exists('activated',$userInfo)) {
+ if (array_key_exists('activated',$userInfo)) {
$user->activated = $userInfo['activated'];
} else if ( !$user->exists ) { // no 'activated' flag was set or unset, *AND* this user is new - activate by default.
$user->activated = 1;
}
- if(array_key_exists('location_id',$userInfo)) {
+ if (array_key_exists('location_id',$userInfo)) {
$user->location_id = $userInfo['location_id'];
}
- $user->notes = 'Imported from LDAP';
+
+ // this is a new user
+ if (!isset($user->id)) {
+ $user->notes = 'Imported from LDAP';
+ }
+
$user->ldap_import = 1;
return $user;
diff --git a/database/migrations/2018_07_28_023826_create_checkout_acceptances_table.php b/database/migrations/2018_07_28_023826_create_checkout_acceptances_table.php
index 67bc3b800a..8a8d32fcfa 100644
--- a/database/migrations/2018_07_28_023826_create_checkout_acceptances_table.php
+++ b/database/migrations/2018_07_28_023826_create_checkout_acceptances_table.php
@@ -17,7 +17,7 @@ class CreateCheckoutAcceptancesTable extends Migration
$table->increments('id');
$table->morphs('checkoutable');
- $table->integer('assigned_to_id')->unsigned();
+ $table->integer('assigned_to_id')->nullable();
$table->string('signature_filename')->nullable();
diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php
index cf936392e4..ed624b9ccf 100644
--- a/resources/lang/en/general.php
+++ b/resources/lang/en/general.php
@@ -112,7 +112,7 @@
'image' => 'Image',
'image_delete' => 'Delete Image',
'image_upload' => 'Upload Image',
- 'image_filetypes_help' => 'Accepted filetypes are jpg, png, gif, and svg. Max upload size allowed is :size.',
+ 'image_filetypes_help' => 'Accepted filetypes are jpg, webp, png, gif, and svg. Max upload size allowed is :size.',
'import' => 'Import',
'importing' => 'Importing',
'importing_help' => 'You can import assets, accessories, licenses, components, consumables, and users via CSV file.
The CSV should be comma-delimited and formatted with headers that match the ones in the sample CSVs in the documentation.',
diff --git a/resources/views/partials/forms/edit/image-upload.blade.php b/resources/views/partials/forms/edit/image-upload.blade.php
index 1676ce669e..78fe48ff8f 100644
--- a/resources/views/partials/forms/edit/image-upload.blade.php
+++ b/resources/views/partials/forms/edit/image-upload.blade.php
@@ -6,7 +6,7 @@