Merge branch 'develop' of https://github.com/snipe/snipe-it into develop

This commit is contained in:
snipe 2019-09-30 19:18:54 -07:00
commit ab05a44e0b
14 changed files with 94 additions and 5 deletions

View file

@ -146,6 +146,10 @@ class AssetsController extends Controller
$asset->requestable = request('requestable', 0);
$asset->rtd_location_id = request('rtd_location_id', null);
if (!empty($settings->audit_interval)) {
$asset->next_audit_date = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
}
if ($asset->assigned_to=='') {
$asset->location_id = $request->input('rtd_location_id', null);
}
@ -477,6 +481,29 @@ class AssetsController extends Controller
}
}
/**
* Return a label for an individual asset.
*
* @author [L. Swartzendruber] [<logan.swartzendruber@gmail.com>
* @param int $assetId
* @return View
*/
public function getLabel($assetId = null)
{
if (isset($assetId)) {
$asset = Asset::find($assetId);
$this->authorize('view', $asset);
return view('hardware/labels')
->with('assets', Asset::find($asset))
->with('settings', Setting::getSettings())
->with('bulkedit', false)
->with('count', 0);
}
}
/**
* Returns a view that presents a form to clone an asset.
*

View file

@ -40,6 +40,7 @@ class BulkAssetsController extends Controller
return view('hardware/labels')
->with('assets', Asset::find($asset_ids))
->with('settings', Setting::getSettings())
->with('bulkedit', true)
->with('count', 0);
case 'delete':
$assets = Asset::with('assignedTo', 'location')->find($asset_ids);

View file

@ -99,9 +99,10 @@ class LoginController extends Controller
private function loginViaRemoteUser(Request $request)
{
$remote_user = $request->server('REMOTE_USER');
$header_name = Setting::getSettings()->login_remote_user_header_name ?: 'REMOTE_USER';
$remote_user = $request->server($header_name);
if (Setting::getSettings()->login_remote_user_enabled == "1" && isset($remote_user) && !empty($remote_user)) {
Log::debug("Authenticatiing via REMOTE_USER.");
Log::debug("Authenticating via HTTP header $header_name.");
$pos = strpos($remote_user, '\\');
if ($pos > 0) {

View file

@ -572,6 +572,7 @@ class SettingsController extends Controller
$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->login_remote_user_header_name = $request->input('login_remote_user_header_name');
}
$setting->pwd_secure_uncommon = (int) $request->input('pwd_secure_uncommon');

View file

@ -71,6 +71,7 @@ class Setting extends Model
'login_remote_user_enabled' => 'numeric|nullable',
'login_common_disabled' => 'numeric|nullable',
'login_remote_user_custom_logout_url' => 'string|nullable',
'login_remote_user_header_name' => 'string|nullable',
'thumbnail_max_h' => 'numeric|max:500|min:25',
'pwd_secure_min' => 'numeric|required|min:5',
'audit_warning_days' => 'numeric|nullable',

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddCustomRemoteUserHeader extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('login_remote_user_header_name')->default("");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('login_remote_user_header_name');
});
}
}

View file

@ -94,6 +94,8 @@ return array(
'login_common_disabled_help' => 'This option disables other authentication mechanisms. Just enable this option if you are sure that your REMOTE_USER login is already working',
'login_remote_user_custom_logout_url_text' => 'Custom logout URL',
'login_remote_user_custom_logout_url_help' => 'If a url is provided here, users will get redirected to this URL after the user logs out of Snipe-IT. This is useful to close the user sessions of your Authentication provider correctly.',
'login_remote_user_header_name_text' => 'Custom user name header',
'login_remote_user_header_name_help' => 'Use the specified header instead of REMOTE_USER',
'logo' => 'Logo',
'logo_print_assets' => 'Use in Print',
'logo_print_assets_help' => 'Use branding on printable asset lists ',

View file

@ -13,4 +13,5 @@ return array(
'upload' => 'Upload',
'select_file' => 'Select File...',
'select_files' => 'Select Files...',
'generate_labels' => '{1} Generate Label|[2,*] Generate Labels',
);

View file

@ -87,6 +87,8 @@ return array(
'login_common_disabled_help' => 'This option disables other authentication mechanisms. Just enable this option if you are sure that your REMOTE_USER login is already working',
'login_remote_user_custom_logout_url_text' => 'Anpassad logga ut URL',
'login_remote_user_custom_logout_url_help' => 'Om en URL tillhandahålls här kommer användarna att omdirigeras till den här webbadressen efter att användaren loggat ut från Snipe-IT. Det här är användbart för att stänga användarsessionerna i din autentiseringsleverantör korrekt.',
'login_remote_user_header_name_text' => 'Anpassat headernamn',
'login_remote_user_header_name_help' => 'Använd en annan header för inloggning än REMOTE_USER',
'logo' => 'Logotyp',
'logo_print_assets' => 'Använd vid utskrift',
'logo_print_assets_help' => 'Använda branding på utskrivbara tillgångs-listor ',

View file

@ -67,9 +67,9 @@
@if (Input::get('status')!='Deleted')
<div id="toolbar">
<select name="bulk_actions" class="form-control select2">
<option value="edit">Edit</option>
<option value="delete">Delete</option>
<option value="labels">Generate Labels</option>
<option value="edit">{{ trans('button.edit') }}</option>
<option value="delete">{{ trans('button.delete') }}</option>
<option value="labels">{{ trans_choice('button.generate_labels', 2) }}</option>
</select>
<button class="btn btn-primary" id="bulkEdit" disabled>Go</button>
</div>

View file

@ -135,7 +135,11 @@
@if ($settings->qr_code=='1')
<div class="label-qr_img qr_img">
@if ($bulkedit==False)
<img src="./qr_code" class="qr_img">
@else
<img src="./{{ $asset->id }}/qr_code" class="qr_img">
@endif
</div>
@endif
@ -182,7 +186,11 @@
@if ((($settings->alt_barcode_enabled=='1') && $settings->alt_barcode!=''))
<div class="label-alt_barcode barcode_container">
@if ($bulkedit==False)
<img src="./barcode" class="barcode">
@else
<img src="./{{ $asset->id }}/barcode" class="barcode">
@endif
</div>
@endif

View file

@ -35,6 +35,7 @@
@can('audit', \App\Models\Asset::class)
<li role="presentation"><a href="{{ route('asset.audit.create', $asset->id) }}">{{ trans('general.audit') }}</a></li>
@endcan
<li role="presentation"><a href="{{ route('label/hardware', $asset->id) }}">{{ trans_choice('button.generate_labels', 1) }}</a></li>
</ul>
</div>
@endcan

View file

@ -133,6 +133,13 @@
<p class="help-block">
{{ trans('admin/settings/general.login_remote_user_enabled_help') }}
</p>
<!-- Use custom remote user header name -->
{{ Form::label('login_remote_user_header_name', trans('admin/settings/general.login_remote_user_header_name_text')) }}
{{ Form::text('login_remote_user_header_name', Input::old('login_remote_user_header_name', $setting->login_remote_user_header_name),array('class' => 'form-control')) }}
{!! $errors->first('login_remote_user_header_name', '<span class="alert-msg">:message</span>') !!}
<p class="help-block">
{{ trans('admin/settings/general.login_remote_user_header_name_help') }}
</p>
<!-- Custom logout url to redirect to authentication provider -->
{{ Form::label('login_remote_user_custom_logout_url', trans('admin/settings/general.login_remote_user_custom_logout_url_text')) }}
{{ Form::text('login_remote_user_custom_logout_url', Input::old('login_remote_user_custom_logout_url', $setting->login_remote_user_custom_logout_url),array('class' => 'form-control')) }}

View file

@ -80,6 +80,11 @@ Route::group(
'uses' => 'Assets\AssetsController@getClone'
]);
Route::get('{assetId}/label', [
'as' => 'label/hardware',
'uses' => 'Assets\AssetsController@getLabel'
]);
Route::post('{assetId}/clone', 'Assets\AssetsController@postCreate');
Route::get('{assetId}/checkout', [