Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
0e1f6a3fd1
9 changed files with 48 additions and 25 deletions
|
@ -84,7 +84,7 @@ class LdapSync extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine which location to assign users to by default. */
|
/* 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')!='') {
|
if ($this->option('location')!='') {
|
||||||
$location = Location::where('name', '=', $this->option('location'))->first();
|
$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_locations = Location::where('ldap_ou', '!=', '')->get()->toArray();
|
||||||
$ldap_ou_lengths = array();
|
$ldap_ou_lengths = array();
|
||||||
|
|
||||||
foreach ($ldap_ou_locations as $location) {
|
foreach ($ldap_ou_locations as $ou_loc) {
|
||||||
$ldap_ou_lengths[] = strlen($location["ldap_ou"]);
|
$ldap_ou_lengths[] = strlen($ou_loc["ldap_ou"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations);
|
array_multisort($ldap_ou_lengths, SORT_ASC, $ldap_ou_locations);
|
||||||
|
|
|
@ -60,6 +60,7 @@ class UsersController extends Controller
|
||||||
'users.updated_at',
|
'users.updated_at',
|
||||||
'users.username',
|
'users.username',
|
||||||
'users.zip',
|
'users.zip',
|
||||||
|
'users.ldap_import',
|
||||||
|
|
||||||
])->with('manager', 'groups', 'userloc', 'company', 'department','assets','licenses','accessories','consumables')
|
])->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');
|
->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',
|
'assets','accessories', 'consumables','licenses','groups','activated','created_at',
|
||||||
'two_factor_enrolled','two_factor_optin','last_login', 'assets_count', 'licenses_count',
|
'two_factor_enrolled','two_factor_optin','last_login', 'assets_count', 'licenses_count',
|
||||||
'consumables_count', 'accessories_count', 'phone', 'address', 'city', 'state',
|
'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';
|
$sort = in_array($request->get('sort'), $allowed_columns) ? $request->get('sort') : 'first_name';
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ImageUploadRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
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',
|
'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::info('File name will be: '.$file_name);
|
||||||
\Log::debug('File extension is: '. $ext);
|
\Log::debug('File extension is: '. $ext);
|
||||||
|
|
||||||
if ($image->getClientOriginalExtension()!=='svg') {
|
if (($image->getClientOriginalExtension()!=='webp') && ($image->getClientOriginalExtension()!=='svg')) {
|
||||||
\Log::debug('Not an SVG - resize');
|
\Log::debug('Not an SVG or webp - resize');
|
||||||
\Log::debug('Trying to upload to: '.$path.'/'.$file_name);
|
\Log::debug('Trying to upload to: '.$path.'/'.$file_name);
|
||||||
$upload = Image::make($image->getRealPath())->resize(null, $w, function ($constraint) {
|
$upload = Image::make($image->getRealPath())->resize(null, $w, function ($constraint) {
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
|
@ -102,9 +102,15 @@ class ImageUploadRequest extends Request
|
||||||
// This requires a string instead of an object, so we use ($string)
|
// This requires a string instead of an object, so we use ($string)
|
||||||
Storage::disk('public')->put($path.'/'.$file_name, (string)$upload->encode());
|
Storage::disk('public')->put($path.'/'.$file_name, (string)$upload->encode());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 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
|
// If the file is an SVG, we need to clean it and NOT encode it
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
\Log::debug('This is an SVG');
|
\Log::debug('This is an SVG');
|
||||||
$sanitizer = new Sanitizer();
|
$sanitizer = new Sanitizer();
|
||||||
$dirtySVG = file_get_contents($image->getRealPath());
|
$dirtySVG = file_get_contents($image->getRealPath());
|
||||||
|
@ -118,6 +124,7 @@ class ImageUploadRequest extends Request
|
||||||
\Log::debug($e);
|
\Log::debug($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Remove Current image if exists
|
// Remove Current image if exists
|
||||||
|
|
|
@ -52,6 +52,7 @@ class UsersTransformer
|
||||||
'notes'=> e($user->notes),
|
'notes'=> e($user->notes),
|
||||||
'permissions' => $user->decodePermissions(),
|
'permissions' => $user->decodePermissions(),
|
||||||
'activated' => ($user->activated =='1') ? true : false,
|
'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_activated' => ($user->two_factor_active()) ? true : false,
|
||||||
'two_factor_enrolled' => ($user->two_factor_active_and_enrolled()) ? true : false,
|
'two_factor_enrolled' => ($user->two_factor_active_and_enrolled()) ? true : false,
|
||||||
'assets_count' => (int) $user->assets_count,
|
'assets_count' => (int) $user->assets_count,
|
||||||
|
|
|
@ -225,6 +225,15 @@ class UserPresenter extends Presenter
|
||||||
"visible" => true,
|
"visible" => true,
|
||||||
'formatter' => 'groupsFormatter'
|
'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",
|
"field" => "two_factor_enrolled",
|
||||||
"searchable" => false,
|
"searchable" => false,
|
||||||
|
|
|
@ -235,15 +235,20 @@ class LdapAd extends LdapAdConfiguration
|
||||||
$user->employee_num = trim($userInfo['employee_number']);
|
$user->employee_num = trim($userInfo['employee_number']);
|
||||||
$user->jobtitle = trim($userInfo['title']);
|
$user->jobtitle = trim($userInfo['title']);
|
||||||
$user->phone = trim($userInfo['telephonenumber']);
|
$user->phone = trim($userInfo['telephonenumber']);
|
||||||
if(array_key_exists('activated',$userInfo)) {
|
if (array_key_exists('activated',$userInfo)) {
|
||||||
$user->activated = $userInfo['activated'];
|
$user->activated = $userInfo['activated'];
|
||||||
} else if ( !$user->exists ) { // no 'activated' flag was set or unset, *AND* this user is new - activate by default.
|
} else if ( !$user->exists ) { // no 'activated' flag was set or unset, *AND* this user is new - activate by default.
|
||||||
$user->activated = 1;
|
$user->activated = 1;
|
||||||
}
|
}
|
||||||
if(array_key_exists('location_id',$userInfo)) {
|
if (array_key_exists('location_id',$userInfo)) {
|
||||||
$user->location_id = $userInfo['location_id'];
|
$user->location_id = $userInfo['location_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is a new user
|
||||||
|
if (!isset($user->id)) {
|
||||||
$user->notes = 'Imported from LDAP';
|
$user->notes = 'Imported from LDAP';
|
||||||
|
}
|
||||||
|
|
||||||
$user->ldap_import = 1;
|
$user->ldap_import = 1;
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
|
|
@ -17,7 +17,7 @@ class CreateCheckoutAcceptancesTable extends Migration
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
|
||||||
$table->morphs('checkoutable');
|
$table->morphs('checkoutable');
|
||||||
$table->integer('assigned_to_id')->unsigned();
|
$table->integer('assigned_to_id')->nullable();
|
||||||
|
|
||||||
$table->string('signature_filename')->nullable();
|
$table->string('signature_filename')->nullable();
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
'image' => 'Image',
|
'image' => 'Image',
|
||||||
'image_delete' => 'Delete Image',
|
'image_delete' => 'Delete Image',
|
||||||
'image_upload' => 'Upload 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',
|
'import' => 'Import',
|
||||||
'importing' => 'Importing',
|
'importing' => 'Importing',
|
||||||
'importing_help' => 'You can import assets, accessories, licenses, components, consumables, and users via CSV file. <br><br>The CSV should be comma-delimited and formatted with headers that match the ones in the <a href="https://snipe-it.readme.io/docs/importing" target="_new">sample CSVs in the documentation</a>.',
|
'importing_help' => 'You can import assets, accessories, licenses, components, consumables, and users via CSV file. <br><br>The CSV should be comma-delimited and formatted with headers that match the ones in the <a href="https://snipe-it.readme.io/docs/importing" target="_new">sample CSVs in the documentation</a>.',
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<label class="btn btn-default" aria-hidden="true">
|
<label class="btn btn-default" aria-hidden="true">
|
||||||
{{ trans('button.select_file') }}
|
{{ trans('button.select_file') }}
|
||||||
<input type="file" name="{{ (isset($fieldname) ? $fieldname : 'image') }}" class="js-uploadFile" id="uploadFile" data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}" accept="image/gif,image/jpeg,image/png,image/svg" style="display:none; max-width: 90%" aria-label="image" aria-hidden="true">
|
<input type="file" name="{{ (isset($fieldname) ? $fieldname : 'image') }}" class="js-uploadFile" id="uploadFile" data-maxsize="{{ \App\Helpers\Helper::file_upload_max_size() }}" accept="image/gif,image/jpeg,image/webp,image/png,image/svg" style="display:none; max-width: 90%" aria-label="image" aria-hidden="true">
|
||||||
</label>
|
</label>
|
||||||
<span class='label label-default' id="uploadFile-info"></span>
|
<span class='label label-default' id="uploadFile-info"></span>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue