Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2016-08-02 01:26:51 -07:00
commit 3d1d248bb5
34 changed files with 569 additions and 226 deletions

View file

@ -19,6 +19,7 @@ use Str;
use View;
use Auth;
use Request;
use Gate;
/** This controller handles all actions related to Accessories for
* the Snipe-IT Asset Management application.
@ -591,7 +592,21 @@ class AccessoriesController extends Controller
$rows = array();
foreach ($accessories as $accessory) {
$actions = '<nobr><a href="'.route('checkout/accessory', $accessory->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($accessory->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/accessory', $accessory->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/accessory', $accessory->id).'" data-content="'.trans('admin/accessories/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($accessory->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr>';
if (Gate::allows('accessories.checkout')) {
$actions .= '<a href="' . route('checkout/accessory',
$accessory->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($accessory->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
}
if (Gate::allows('accessories.edit')) {
$actions .= '<a href="' . route('update/accessory',
$accessory->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
}
if (Gate::allows('accessories.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/accessory',
$accessory->id) . '" data-content="' . trans('admin/accessories/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($accessory->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .= '</nobr>';
$company = $accessory->company;
$rows[] = array(
@ -654,10 +669,20 @@ class AccessoriesController extends Controller
$rows = array();
foreach ($accessory_users as $user) {
$actions = '<a href="'.route('checkin/accessory', $user->pivot->id).'" class="btn btn-info btn-sm">Checkin</a>';
$actions = '';
if (Gate::allows('accessories.checkin')) {
$actions .= '<a href="' . route('checkin/accessory',
$user->pivot->id) . '" class="btn btn-info btn-sm">Checkin</a>';
}
if (Gate::allows('users.view')) {
$name = (string) link_to('/admin/users/'.$user->id.'/view', e($user->fullName()));
} else {
$name = e($user->fullName());
}
$rows[] = array(
'name' =>(string) link_to('/admin/users/'.$user->id.'/view', e($user->fullName())),
'name' => $name,
'actions' => $actions
);
}

View file

@ -40,6 +40,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use TCPDF;
use View;
use Carbon\Carbon;
use Gate;
/**
* This class controls all actions related to assets for
@ -761,14 +762,20 @@ class AssetsController extends Controller
if ($settings->qr_code == '1') {
$asset = Asset::find($assetId);
$size = Helper::barcodeDimensions($settings->barcode_type);
$qr_file = public_path().'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'.png';
if (isset($asset->id,$asset->asset_tag)) {
$barcode = new \Com\Tecnick\Barcode\Barcode();
$barcode_obj = $barcode->getBarcodeObj($settings->barcode_type, route('view/hardware', $asset->id), $size['height'], $size['width'], 'black', array(-2, -2, -2, -2));
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
if (file_exists($qr_file)) {
$header = ['Content-type' => 'image/png'];
return response()->file($qr_file, $header);
} else {
$barcode = new \Com\Tecnick\Barcode\Barcode();
$barcode_obj = $barcode->getBarcodeObj($settings->barcode_type, route('view/hardware', $asset->id), $size['height'], $size['width'], 'black', array(-2, -2, -2, -2));
file_put_contents($qr_file,$barcode_obj->getPngData());
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
}
}
}
@ -788,12 +795,20 @@ class AssetsController extends Controller
$settings = Setting::getSettings();
$asset = Asset::find($assetId);
$barcode_file = public_path().'/uploads/barcodes/'.str_slug($settings->alt_barcode).'-'.str_slug($asset->asset_tag).'.png';
if (isset($asset->id,$asset->asset_tag)) {
$barcode = new \Com\Tecnick\Barcode\Barcode();
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, 250, 20);
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
if (file_exists($barcode_file)) {
$header = ['Content-type' => 'image/png'];
return response()->file($barcode_file, $header);
} else {
$barcode = new \Com\Tecnick\Barcode\Barcode();
$barcode_obj = $barcode->getBarcodeObj($settings->alt_barcode, $asset->asset_tag, 250, 20);
file_put_contents($barcode_file,$barcode_obj->getPngData());
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
}
}
}
@ -1533,7 +1548,18 @@ class AssetsController extends Controller
$inout = '';
$actions = '';
if ($asset->deleted_at=='') {
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
if (Gate::allows('assets.create')) {
$actions = '<div style=" white-space: nowrap;"><a href="' . route('clone/hardware',
$asset->id) . '" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i>';
}
if (Gate::allows('assets.edit')) {
$actions .= '</a> <a href="' . route('update/hardware',
$asset->id) . '" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> ';
}
if (Gate::allows('assets.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/hardware',
$asset->id) . '" data-content="' . trans('admin/hardware/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($asset->asset_tag) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
}
} elseif ($asset->model->deleted_at=='') {
$actions = '<a href="'.route('restore/hardware', $asset->id).'" title="Restore asset" data-toggle="tooltip" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
}
@ -1541,9 +1567,15 @@ class AssetsController extends Controller
if ($asset->assetstatus) {
if (($asset->assetstatus->deployable != 0) && ($asset->deleted_at=='')) {
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">'.trans('general.checkin').'</a>';
if (Gate::allows('assets.checkin')) {
$inout = '<a href="' . route('checkin/hardware',
$asset->id) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
}
} else {
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">'.trans('general.checkout').'</a>';
if (Gate::allows('assets.checkout')) {
$inout = '<a href="' . route('checkout/hardware',
$asset->id) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
}
}
}
}

View file

@ -20,6 +20,7 @@ use Str;
use View;
use Validator;
use Illuminate\Http\Request;
use Gate;
/**
* This class controls all actions related to Components for
@ -454,7 +455,23 @@ class ComponentsController extends Controller
$rows = array();
foreach ($components as $component) {
$actions = '<nobr><a href="'.route('checkout/component', $component->id).'" style="margin-right:5px;" class="btn btn-info btn-sm '.(($component->numRemaining() > 0 ) ? '' : ' disabled').'" '.(($component->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/component', $component->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/component', $component->id).'" data-content="'.trans('admin/components/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($component->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr>';
if (Gate::allows('components.checkout')) {
$actions .= '<a href="' . route('checkout/component',
$component->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm ' . (($component->numRemaining() > 0) ? '' : ' disabled') . '" ' . (($component->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
}
if (Gate::allows('components.edit')) {
$actions .= '<a href="' . route('update/component',
$component->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
}
if (Gate::allows('components.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/component',
$component->id) . '" data-content="' . trans('admin/components/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($component->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .='</nobr>';
$company = $component->company;
$rows[] = array(

View file

@ -18,6 +18,7 @@ use Redirect;
use Slack;
use Str;
use View;
use Gate;
/**
* This controller handles all actions related to Consumables for
@ -444,7 +445,23 @@ class ConsumablesController extends Controller
$rows = array();
foreach ($consumables as $consumable) {
$actions = '<nobr><a href="'.route('checkout/consumable', $consumable->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($consumable->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/consumable', $consumable->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/consumable', $consumable->id).'" data-content="'.trans('admin/consumables/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($consumable->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr>';
if (Gate::allows('consumables.checkout')) {
$actions .= '<a href="' . route('checkout/consumable',
$consumable->id) . '" style="margin-right:5px;" class="btn btn-info btn-sm" ' . (($consumable->numRemaining() > 0) ? '' : ' disabled') . '>' . trans('general.checkout') . '</a>';
}
if (Gate::allows('consumables.edit')) {
$actions .= '<a href="' . route('update/consumable',
$consumable->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
}
if (Gate::allows('consumables.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/consumable',
$consumable->id) . '" data-content="' . trans('admin/consumables/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($consumable->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .='</nobr>';
$company = $consumable->company;
$rows[] = array(

View file

@ -23,6 +23,7 @@ use Config;
use Session;
use App\Helpers\Helper;
use Auth;
use Gate;
/**
* This controller handles all actions related to Licenses for
@ -983,7 +984,26 @@ class LicensesController extends Controller
$rows = array();
foreach ($licenses as $license) {
$actions = '<span style="white-space: nowrap;"><a href="'.route('freecheckout/license', $license->id).'" class="btn btn-primary btn-sm'.(($license->remaincount() > 0) ? '' : ' disabled').'" style="margin-right:5px;">'.trans('general.checkout').'</a> <a href="'.route('clone/license', $license->id).'" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a><a href="'.route('update/license', $license->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/license', $license->id).'" data-content="'.trans('admin/licenses/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($license->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></span>';
$actions = '<span style="white-space: nowrap;">';
if (Gate::allows('licenses.checkout')) {
$actions .= '<a href="' . route('freecheckout/license',
$license->id) . '" class="btn btn-primary btn-sm' . (($license->remaincount() > 0) ? '' : ' disabled') . '" style="margin-right:5px;">' . trans('general.checkout') . '</a> ';
}
if (Gate::allows('licenses.create')) {
$actions .= '<a href="' . route('clone/license',
$license->id) . '" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a>';
}
if (Gate::allows('licenses.edit')) {
$actions .= '<a href="' . route('update/license',
$license->id) . '" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a>';
}
if (Gate::allows('licenses.delete')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/license',
$license->id) . '" data-content="' . trans('admin/licenses/message.delete.confirm') . '" data-title="' . trans('general.delete') . ' ' . htmlspecialchars($license->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
}
$actions .='</span>';
$rows[] = array(
'id' => $license->id,

View file

@ -876,7 +876,7 @@ class UsersController extends Controller
}
$users = User::select(array('users.id','users.employee_num','users.email','users.username','users.location_id','users.manager_id','users.first_name','users.last_name','users.created_at','users.notes','users.company_id', 'users.deleted_at','users.activated'))
->with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'groups', 'userloc', 'company');
->with('assets', 'accessories', 'consumables', 'licenses', 'manager', 'groups', 'userloc', 'company','throttle');
$users = Company::scopeCompanyables($users);
switch ($status) {
@ -923,32 +923,39 @@ class UsersController extends Controller
$group_names .= '<a href="' . config('app.url') . '/admin/groups/' . $group->id . '/edit" class="label label-default">' . $group->name . '</a> ';
}
if (Gate::allows('users:edit')) {
if (!is_null($user->deleted_at)) {
$actions .= '<a href="' . route('restore/user',
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
if (!is_null($user->deleted_at)) {
if (Gate::allows('users.delete')) {
$actions .= '<a href="' . route('restore/user',
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
}
} else {
if ($user->accountStatus() == 'suspended') {
$actions .= '<a href="' . route('unsuspend/user',
$user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
if (Gate::allows('users.delete')) {
if ($user->accountStatus() == 'suspended') {
$actions .= '<a href="' . route('unsuspend/user',
$user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
}
}
if (Gate::allows('users.edit')) {
$actions .= '<a href="' . route('update/user',
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
$actions .= '<a href="' . route('update/user',
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
$actions .= '<a href="' . route('clone/user',
$user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user',
$user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
$actions .= '<a href="' . route('clone/user',
$user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
}
if (Gate::allows('users.delete')) {
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user',
$user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
} else {
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
}
} else {
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
$actions.='foo';
}
}
}
$actions .= '</nobr>';
$rows[] = array(

View file

@ -184,79 +184,125 @@ Route::group([ 'prefix' => 'api', 'middleware' => 'auth' ], function () {
Route::group(
[ 'prefix' => 'hardware',
'middleware' => ['web',
'auth',
'authorize:assets.view']],
'auth']],
function () {
Route::get('create/{model?}', [
'as' => 'create/hardware',
'middleware' => 'authorize:assets.create',
'uses' => 'AssetsController@getCreate'
]);
Route::post('create', [
'as' => 'savenew/hardware',
'middleware' => 'authorize:assets.create',
'uses' => 'AssetsController@postCreate'
]);
Route::get('{assetId}/edit', [
'as' => 'update/hardware',
'middleware' => 'authorize:assets.edit',
'uses' => 'AssetsController@getEdit'
]);
Route::get('/bytag', [
'as' => 'findbytag/hardware',
'middleware' => 'authorize:assets.view',
'uses' => 'AssetsController@getAssetByTag'
]);
Route::get('{assetId}/clone', [ 'as' => 'clone/hardware', 'uses' => 'AssetsController@getClone' ]);
Route::get('{assetId}/clone', [
'as' => 'clone/hardware',
'middleware' => 'authorize:assets.create',
'uses' => 'AssetsController@getClone'
]);
Route::post('{assetId}/clone', 'AssetsController@postCreate');
Route::get('{assetId}/delete', [ 'as' => 'delete/hardware', 'uses' => 'AssetsController@getDelete' ]);
Route::get(
'{assetId}/checkout',
[ 'as' => 'checkout/hardware', 'uses' => 'AssetsController@getCheckout' ]
);
Route::post('{assetId}/checkout', 'AssetsController@postCheckout');
Route::get(
'{assetId}/checkin/{backto?}',
[ 'as' => 'checkin/hardware', 'uses' => 'AssetsController@getCheckin' ]
);
Route::post('{assetId}/checkin/{backto?}', 'AssetsController@postCheckin');
Route::get('{assetId}/view', [ 'as' => 'view/hardware', 'uses' => 'AssetsController@getView' ]);
Route::get('{assetId}/delete', [
'as' => 'delete/hardware',
'middleware' => 'authorize:assets.delete',
'uses' => 'AssetsController@getDelete'
]);
Route::get('{assetId}/checkout', [
'as' => 'checkout/hardware',
'middleware' => 'authorize:assets.checkout',
'uses' => 'AssetsController@getCheckout'
]);
Route::post('{assetId}/checkout', [
'as' => 'checkout/hardware',
'middleware' => 'authorize:assets.checkout',
'uses' => 'AssetsController@postCheckout'
]);
Route::get('{assetId}/checkin/{backto?}', [
'as' => 'checkin/hardware',
'middleware' => 'authorize:assets.checkin',
'uses' => 'AssetsController@getCheckin'
]);
Route::post('{assetId}/checkin/{backto?}', [
'as' => 'checkin/hardware',
'middleware' => 'authorize:assets.checkin',
'uses' => 'AssetsController@postCheckin'
]);
Route::get('{assetId}/view', [
'as' => 'view/hardware',
'middleware' => ['authorize:assets.view'],
'uses' => 'AssetsController@getView'
]);
Route::get('{assetId}/qr-view', [ 'as' => 'qr-view/hardware', 'uses' => 'AssetsController@getView' ]);
Route::get('{assetId}/qr_code', [ 'as' => 'qr_code/hardware', 'uses' => 'AssetsController@getQrCode' ]);
Route::get('{assetId}/barcode', [ 'as' => 'barcode/hardware', 'uses' => 'AssetsController@getBarCode' ]);
Route::get('{assetId}/restore', [ 'as' => 'restore/hardware', 'uses' => 'AssetsController@getRestore' ]);
Route::post('{assetId}/upload', [ 'as' => 'upload/asset', 'uses' => 'AssetsController@postUpload' ]);
Route::get(
'{assetId}/deletefile/{fileId}',
[ 'as' => 'delete/assetfile', 'uses' => 'AssetsController@getDeleteFile' ]
);
Route::get(
'{assetId}/showfile/{fileId}',
[ 'as' => 'show/assetfile', 'uses' => 'AssetsController@displayFile' ]
);
Route::get('{assetId}/restore', [
'as' => 'restore/hardware',
'middleware' => 'authorize:assets.delete',
'uses' => 'AssetsController@getRestore'
]);
Route::post('{assetId}/upload', [
'as' => 'upload/asset',
'middleware' => 'authorize:assets.edit',
'uses' => 'AssetsController@postUpload'
]);
Route::get(
'import/delete-import/{filename}',
[ 'as' => 'assets/import/delete-file', 'uses' => 'AssetsController@getDeleteImportFile' ]
);
Route::get('{assetId}/deletefile/{fileId}', [
'as' => 'delete/assetfile',
'middleware' => 'authorize:assets.edit',
'uses' => 'AssetsController@getDeleteFile'
]);
Route::get(
'import/process/{filename}',
[ 'as' => 'assets/import/process-file', 'uses' => 'AssetsController@getProcessImportFile' ]
);
Route::get('{assetId}/showfile/{fileId}', [
'as' => 'show/assetfile',
'middleware' => 'authorize:assets.view',
'uses' => 'AssetsController@displayFile'
]);
Route::get(
'import',
[ 'as' => 'assets/import', 'uses' => 'AssetsController@getImportUpload' ]
);
Route::get('import/delete-import/{filename}', [
'as' => 'assets/import/delete-file',
'middleware' => 'authorize:assets.create',
'uses' => 'AssetsController@getDeleteImportFile'
]);
Route::get( 'import/process/{filename}', [ 'as' => 'assets/import/process-file',
'middleware' => 'authorize:assets.create',
'uses' => 'AssetsController@getProcessImportFile'
]);
Route::get('import',[
'as' => 'assets/import',
'middleware' => 'authorize:assets.create',
'uses' => 'AssetsController@getImportUpload'
]);
Route::post('{assetId}/edit', 'AssetsController@postEdit');
Route::post('{assetId}/edit',[
'as' => 'assets/import',
'middleware' => 'authorize:assets.edit',
'uses' => 'AssetsController@postEdit'
]);
Route::post(
'bulkedit',
[
'as' => 'hardware/bulkedit',
'middleware' => 'authorize:assets.edit',
'uses' => 'AssetsController@postBulkEdit'
]
);
@ -264,6 +310,7 @@ Route::group(
'bulkdelete',
[
'as' => 'hardware/bulkdelete',
'middleware' => 'authorize:assets.delete',
'uses' => 'AssetsController@postBulkDelete'
]
);
@ -271,16 +318,22 @@ Route::group(
'bulksave',
[
'as' => 'hardware/bulksave',
'middleware' => 'authorize:assets.edit',
'uses' => 'AssetsController@postBulkSave'
]
);
# Bulk checkout / checkin
Route::get(
'bulkcheckout',
[ 'as' => 'hardware/bulkcheckout', 'uses' => 'AssetsController@getBulkCheckout' ]
);
Route::post('bulkcheckout', 'AssetsController@postBulkCheckout');
Route::get( 'bulkcheckout', [
'as' => 'hardware/bulkcheckout',
'middleware' => 'authorize:assets.checkout',
'uses' => 'AssetsController@getBulkCheckout'
]);
Route::post( 'bulkcheckout', [
'as' => 'hardware/bulkcheckout',
'middleware' => 'authorize:assets.checkout',
'uses' => 'AssetsController@postBulkCheckout'
]);
# Asset Model Management
Route::group([ 'prefix' => 'models', 'middleware' => 'auth' ], function () {
@ -300,6 +353,7 @@ Route::group(
Route::get('/', [
'as' => 'hardware',
'middleware' => 'authorize:assets.view',
'uses' => 'AssetsController@getIndex'
]);
@ -320,41 +374,57 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
# Licenses
Route::group([ 'prefix' => 'licenses', 'middleware'=>'authorize:licenses.view' ], function () {
Route::get('create', [ 'as' => 'create/licenses', 'uses' => 'LicensesController@getCreate' ]);
Route::post('create', 'LicensesController@postCreate');
Route::get('{licenseId}/edit', [ 'as' => 'update/license', 'uses' => 'LicensesController@getEdit' ]);
Route::post('{licenseId}/edit', 'LicensesController@postEdit');
Route::get('{licenseId}/clone', [ 'as' => 'clone/license', 'uses' => 'LicensesController@getClone' ]);
Route::post('{licenseId}/clone', 'LicensesController@postCreate');
Route::get('{licenseId}/delete', [ 'as' => 'delete/license', 'uses' => 'LicensesController@getDelete' ]);
Route::get(
'{licenseId}/freecheckout',
[ 'as' => 'freecheckout/license', 'uses' => 'LicensesController@getFreeLicense' ]
);
Route::get('create', [ 'as' => 'create/licenses', 'middleware' => 'authorize:licenses.create','uses' => 'LicensesController@getCreate' ]);
Route::post('create', [ 'as' => 'create/licenses', 'middleware' => 'authorize:licenses.create','uses' => 'LicensesController@postCreate' ]);
Route::get('{licenseId}/edit', [ 'as' => 'update/license', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@getEdit' ]);
Route::post('{licenseId}/edit', [ 'as' => 'update/license', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@postEdit' ]);
Route::get('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@getClone' ]);
Route::post('{licenseId}/clone', [ 'as' => 'clone/license', 'middleware' => 'authorize:licenses.create', 'uses' => 'LicensesController@postCreate' ]);
Route::get('{licenseId}/delete', [ 'as' => 'delete/license', 'middleware' => 'authorize:licenses.delete', 'uses' => 'LicensesController@getDelete' ]);
Route::get('{licenseId}/freecheckout', [
'as' => 'freecheckout/license',
'middleware' => 'authorize:licenses.checkout',
'uses' => 'LicensesController@getFreeLicense'
]);
Route::get(
'{licenseId}/checkout',
[ 'as' => 'checkout/license', 'uses' => 'LicensesController@getCheckout' ]
[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@getCheckout' ]
);
Route::post('{licenseId}/checkout', 'LicensesController@postCheckout');
Route::get(
'{licenseId}/checkin/{backto?}',
[ 'as' => 'checkin/license', 'uses' => 'LicensesController@getCheckin' ]
Route::post(
'{licenseId}/checkout',
[ 'as' => 'checkout/license', 'middleware' => 'authorize:licenses.checkout','uses' => 'LicensesController@postCheckout' ]
);
Route::post('{licenseId}/checkin/{backto?}', 'LicensesController@postCheckin');
Route::get('{licenseId}/view', [ 'as' => 'view/license', 'uses' => 'LicensesController@getView' ]);
Route::get('{licenseId}/checkin/{backto?}', [
'as' => 'checkin/license',
'middleware' => 'authorize:licenses.checkin',
'uses' => 'LicensesController@getCheckin'
]);
Route::post('{licenseId}/checkin/{backto?}', [
'as' => 'checkin/license',
'middleware' => 'authorize:licenses.checkin',
'uses' => 'LicensesController@postCheckin'
]);
Route::get('{licenseId}/view', [
'as' => 'view/license',
'middleware' => 'authorize:licenses.view',
'uses' => 'LicensesController@getView'
]);
Route::post(
'{licenseId}/upload',
[ 'as' => 'upload/license', 'uses' => 'LicensesController@postUpload' ]
[ 'as' => 'upload/license', 'middleware' => 'authorize:licenses.edit','uses' => 'LicensesController@postUpload' ]
);
Route::get(
'{licenseId}/deletefile/{fileId}',
[ 'as' => 'delete/licensefile', 'uses' => 'LicensesController@getDeleteFile' ]
[ 'as' => 'delete/licensefile', 'middleware' => 'authorize:licenses.edit', 'uses' => 'LicensesController@getDeleteFile' ]
);
Route::get(
'{licenseId}/showfile/{fileId}',
[ 'as' => 'show/licensefile', 'uses' => 'LicensesController@displayFile' ]
[ 'as' => 'show/licensefile', 'middleware' => 'authorize:licenses.view','uses' => 'LicensesController@displayFile' ]
);
Route::get('/', [ 'as' => 'licenses', 'uses' => 'LicensesController@getIndex' ]);
Route::get('/', [ 'as' => 'licenses', 'middleware' => 'authorize:licenses.view','uses' => 'LicensesController@getIndex' ]);
});
# Asset Maintenances
@ -384,84 +454,103 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
# Accessories
Route::group([ 'prefix' => 'accessories', 'middleware'=>'authorize:accessories.view' ], function () {
Route::get('create', [ 'as' => 'create/accessory', 'uses' => 'AccessoriesController@getCreate' ]);
Route::get('create', [ 'as' => 'create/accessory', 'middleware' => 'authorize:accessories.create','uses' => 'AccessoriesController@getCreate' ]);
Route::post('create', 'AccessoriesController@postCreate');
Route::get(
'{accessoryID}/edit',
[ 'as' => 'update/accessory', 'uses' => 'AccessoriesController@getEdit' ]
[ 'as' => 'update/accessory', 'middleware' => 'authorize:accessories.edit','uses' => 'AccessoriesController@getEdit' ]
);
Route::post('{accessoryID}/edit', 'AccessoriesController@postEdit');
Route::get(
'{accessoryID}/delete',
[ 'as' => 'delete/accessory', 'uses' => 'AccessoriesController@getDelete' ]
[ 'as' => 'delete/accessory', 'middleware' => 'authorize:accessories.delete','uses' => 'AccessoriesController@getDelete' ]
);
Route::get('{accessoryID}/view', [ 'as' => 'view/accessory', 'uses' => 'AccessoriesController@getView' ]);
Route::get('{accessoryID}/view', [ 'as' => 'view/accessory', 'middleware' => 'authorize:accessories.view','uses' => 'AccessoriesController@getView' ]);
Route::get(
'{accessoryID}/checkout',
[ 'as' => 'checkout/accessory', 'uses' => 'AccessoriesController@getCheckout' ]
[ 'as' => 'checkout/accessory', 'middleware' => 'authorize:accessories.checkout','uses' => 'AccessoriesController@getCheckout' ]
);
Route::post('{accessoryID}/checkout', 'AccessoriesController@postCheckout');
Route::post(
'{accessoryID}/checkout',
[ 'as' => 'checkout/accessory', 'middleware' => 'authorize:accessories.checkout','uses' => 'AccessoriesController@postCheckout' ]
);
Route::get(
'{accessoryID}/checkin/{backto?}',
[ 'as' => 'checkin/accessory', 'uses' => 'AccessoriesController@getCheckin' ]
[ 'as' => 'checkin/accessory', 'middleware' => 'authorize:accessories.checkin','uses' => 'AccessoriesController@getCheckin' ]
);
Route::post(
'{accessoryID}/checkin/{backto?}',
[ 'as' => 'checkin/accessory', 'middleware' => 'authorize:accessories.checkin','uses' => 'AccessoriesController@postCheckin' ]
);
Route::post('{accessoryID}/checkin/{backto?}', 'AccessoriesController@postCheckin');
Route::get('/', [ 'as' => 'accessories', 'uses' => 'AccessoriesController@getIndex' ]);
Route::get('/', [ 'as' => 'accessories', 'middleware'=>'authorize:accessories.view', 'uses' => 'AccessoriesController@getIndex' ]);
});
# Consumables
Route::group([ 'prefix' => 'consumables', 'middleware'=>'authorize:consumables.view' ], function () {
Route::get('create', [ 'as' => 'create/consumable', 'uses' => 'ConsumablesController@getCreate' ]);
Route::post('create', 'ConsumablesController@postCreate');
Route::get('create', [ 'as' => 'create/consumable','middleware'=>'authorize:consumables.create', 'uses' => 'ConsumablesController@getCreate' ]);
Route::post('create', [ 'as' => 'create/consumable','middleware'=>'authorize:consumables.create', 'uses' => 'ConsumablesController@postCreate' ]);
Route::get(
'{consumableID}/edit',
[ 'as' => 'update/consumable', 'uses' => 'ConsumablesController@getEdit' ]
[ 'as' => 'update/consumable', 'middleware'=>'authorize:consumables.edit', 'uses' => 'ConsumablesController@getEdit' ]
);
Route::post(
'{consumableID}/edit',
[ 'as' => 'update/consumable', 'middleware'=>'authorize:consumables.edit', 'uses' => 'ConsumablesController@postEdit' ]
);
Route::post('{consumableID}/edit', 'ConsumablesController@postEdit');
Route::get(
'{consumableID}/delete',
[ 'as' => 'delete/consumable', 'uses' => 'ConsumablesController@getDelete' ]
[ 'as' => 'delete/consumable', 'middleware'=>'authorize:consumables.delete','uses' => 'ConsumablesController@getDelete' ]
);
Route::get(
'{consumableID}/view',
[ 'as' => 'view/consumable', 'uses' => 'ConsumablesController@getView' ]
[ 'as' => 'view/consumable', 'middleware'=>'authorize:consumables.view','uses' => 'ConsumablesController@getView' ]
);
Route::get(
'{consumableID}/checkout',
[ 'as' => 'checkout/consumable', 'uses' => 'ConsumablesController@getCheckout' ]
[ 'as' => 'checkout/consumable', 'middleware'=>'authorize:consumables.checkout','uses' => 'ConsumablesController@getCheckout' ]
);
Route::post('{consumableID}/checkout', 'ConsumablesController@postCheckout');
Route::get('/', [ 'as' => 'consumables', 'uses' => 'ConsumablesController@getIndex' ]);
Route::post(
'{consumableID}/checkout',
[ 'as' => 'checkout/consumable', 'middleware'=>'authorize:consumables.checkout','uses' => 'ConsumablesController@postCheckout' ]
);
Route::get('/', [ 'as' => 'consumables', 'middleware'=>'authorize:consumables.view','uses' => 'ConsumablesController@getIndex' ]);
});
# Components
Route::group([ 'prefix' => 'components', 'middleware'=>'authorize:components.view' ], function () {
Route::get('create', [ 'as' => 'create/component', 'uses' => 'ComponentsController@getCreate' ]);
Route::post('create', 'ComponentsController@postCreate');
Route::get('create', [ 'as' => 'create/component', 'middleware'=>'authorize:components.create','uses' => 'ComponentsController@getCreate' ]);
Route::post('create', [ 'as' => 'create/component', 'middleware'=>'authorize:components.create','uses' => 'ComponentsController@postCreate' ]);
Route::get(
'{componentID}/edit',
[ 'as' => 'update/component', 'uses' => 'ComponentsController@getEdit' ]
[ 'as' => 'update/component', 'middleware'=>'authorize:components.edit','uses' => 'ComponentsController@getEdit' ]
);
Route::post(
'{componentID}/edit',
[ 'as' => 'update/component', 'middleware'=>'authorize:components.edit','uses' => 'ComponentsController@postEdit' ]
);
Route::post('{componentID}/edit', 'ComponentsController@postEdit');
Route::get(
'{componentID}/delete',
[ 'as' => 'delete/component', 'uses' => 'ComponentsController@getDelete' ]
[ 'as' => 'delete/component', 'middleware'=>'authorize:components.delete','uses' => 'ComponentsController@getDelete' ]
);
Route::get(
'{componentID}/view',
[ 'as' => 'view/component', 'uses' => 'ComponentsController@getView' ]
[ 'as' => 'view/component', 'middleware'=>'authorize:components.view','uses' => 'ComponentsController@getView' ]
);
Route::get(
'{componentID}/checkout',
[ 'as' => 'checkout/component', 'uses' => 'ComponentsController@getCheckout' ]
[ 'as' => 'checkout/component', 'middleware'=>'authorize:components.checkout','uses' => 'ComponentsController@getCheckout' ]
);
Route::post('{componentID}/checkout', 'ComponentsController@postCheckout');
Route::post('bulk', [ 'as' => 'component/bulk-form', 'uses' => 'ComponentsController@postBulk' ]);
Route::post('bulksave', [ 'as' => 'component/bulk-save', 'uses' => 'ComponentsController@postBulkSave' ]);
Route::get('/', [ 'as' => 'components', 'uses' => 'ComponentsController@getIndex' ]);
Route::post(
'{componentID}/checkout',
[ 'as' => 'checkout/component', 'middleware'=>'authorize:components.checkout','uses' => 'ComponentsController@postCheckout' ]
);
Route::post('bulk', [ 'as' => 'component/bulk-form', 'middleware'=>'authorize:components.checkout','uses' => 'ComponentsController@postBulk' ]);
Route::post('bulksave', [ 'as' => 'component/bulk-save', 'middleware'=>'authorize:components.edit','uses' => 'ComponentsController@postBulkSave' ]);
Route::get('/', [ 'as' => 'components', 'middleware'=>'authorize:components.view','uses' => 'ComponentsController@getIndex' ]);
});
# Admin Settings Routes (for categories, maufactureres, etc)

View file

@ -232,10 +232,10 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
public function accountStatus()
{
if ($this->sentryThrottle) {
if ($this->sentryThrottle->suspended==1) {
if ($this->throttle) {
if ($this->throttle->suspended==1) {
return 'suspended';
} elseif ($this->sentryThrottle->banned==1) {
} elseif ($this->throttle->banned==1) {
return 'banned';
} else {
return false;
@ -262,7 +262,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
->orderBy('created_at', 'desc');
}
public function sentryThrottle()
public function throttle()
{
return $this->hasOne('\App\Models\Throttle');
}

View file

@ -91,6 +91,13 @@ class AuthServiceProvider extends ServiceProvider
}
});
// Checks for some level of management
$gate->define('assets.manage', function ($user) {
if (($user->hasAccess('assets.checkin')) || ($user->hasAccess('assets.edit')) || ($user->hasAccess('assets.delete')) || ($user->hasAccess('assets.checkout')) || ($user->hasAccess('admin'))) {
return true;
}
});
# -----------------------------------------
# Accessories
@ -131,6 +138,13 @@ class AuthServiceProvider extends ServiceProvider
}
});
// Checks for some level of management
$gate->define('accessories.manage', function ($user) {
if (($user->hasAccess('accessories.checkin')) || ($user->hasAccess('accessories.edit')) || ($user->hasAccess('accessories.checkout')) || ($user->hasAccess('admin'))) {
return true;
}
});
# -----------------------------------------
# Consumables
# -----------------------------------------
@ -170,6 +184,13 @@ class AuthServiceProvider extends ServiceProvider
}
});
// Checks for some level of management
$gate->define('consumables.manage', function ($user) {
if (($user->hasAccess('consumables.checkin')) || ($user->hasAccess('consumables.edit')) || ($user->hasAccess('consumables.delete')) || ($user->hasAccess('consumables.checkout')) || ($user->hasAccess('admin'))) {
return true;
}
});
# -----------------------------------------
@ -228,6 +249,13 @@ class AuthServiceProvider extends ServiceProvider
}
});
// Checks for some level of management
$gate->define('components.manage', function ($user) {
if (($user->hasAccess('components.edit')) || ($user->hasAccess('components.delete')) || ($user->hasAccess('components.checkout')) || ($user->hasAccess('admin'))) {
return true;
}
});
# -----------------------------------------
# Licenses
@ -274,6 +302,13 @@ class AuthServiceProvider extends ServiceProvider
}
});
// Checks for some level of management
$gate->define('licenses.manage', function ($user) {
if (($user->hasAccess('licenses.checkin')) || ($user->hasAccess('licenses.edit')) || ($user->hasAccess('licenses.delete')) || ($user->hasAccess('licenses.checkout')) || ($user->hasAccess('admin'))) {
return true;
}
});
}
}

View file

@ -46,19 +46,19 @@ return array(
'permission' => 'assets.create',
'label' => 'Create ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'assets.edit',
'label' => 'Edit ',
'label' => 'Edit ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'assets.delete',
'label' => 'Delete ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'assets.checkout',
@ -71,7 +71,14 @@ return array(
'permission' => 'assets.checkin',
'label' => 'Checkin ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'assets.checkout',
'label' => 'Checkout ',
'note' => '',
'display' => true,
),
array(
@ -88,6 +95,7 @@ return array(
'note' => '',
'display' => true,
),
),
'Accessories' => array(
@ -101,31 +109,31 @@ return array(
'permission' => 'accessory.create',
'label' => 'Create ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'accessories.edit',
'label' => 'Edit ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'accessories.delete',
'label' => 'Delete ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'accessories.checkout',
'label' => 'Checkout ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'accessories.checkin',
'label' => 'Checkin ',
'note' => '',
'display' => false,
'display' => true,
),
),
@ -140,25 +148,25 @@ return array(
'permission' => 'consumables.create',
'label' => 'Create ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'consumables.edit',
'label' => 'Edit ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'consumables.delete',
'label' => 'Delete ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'consumables.checkout',
'label' => 'Checkout ',
'note' => '',
'display' => false,
'display' => true,
),
),
@ -172,27 +180,27 @@ return array(
),
array(
'permission' => 'licenses.create',
'label' => 'Create Licenses',
'label' => 'Create ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'licenses.edit',
'label' => 'Edit Licenses',
'label' => 'Edit ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'licenses.delete',
'label' => 'Delete Licenses',
'label' => 'Delete ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'licenses.checkout',
'label' => 'Checkout Licenses',
'label' => 'Checkout ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'licenses.keys',
@ -212,33 +220,33 @@ return array(
),
array(
'permission' => 'components.create',
'label' => 'Create Components',
'label' => 'Create ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'components.edit',
'label' => 'Edit Components',
'label' => 'Edit ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'components.delete',
'label' => 'Delete Components',
'label' => 'Delete ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'components.checkout',
'label' => 'Checkout Components',
'label' => 'Checkout ',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'components.checkin',
'label' => 'Checkin Components',
'label' => 'Checkin ',
'note' => '',
'display' => false,
'display' => true,
),
),
@ -254,19 +262,19 @@ return array(
'permission' => 'users.create',
'label' => 'Create Users',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'users.edit',
'label' => 'Edit Users',
'note' => '',
'display' => false,
'display' => true,
),
array(
'permission' => 'users.delete',
'label' => 'Delete Users',
'note' => '',
'display' => false,
'display' => true,
),
),

View file

@ -1,5 +1,5 @@
<?php
return array (
'app_version' => 'v3.1',
'hash_version' => 'v3.1-84-g139325d',
);
'app_version' => 'v3.0',
'hash_version' => 'v3.0-95-gde17da0',
);

View file

@ -38,7 +38,7 @@ elixir(function(mix) {
mix.version(['assets/css/app.css','assets/js/all.js']);
// mix.codeception();
mix.codeception();

1
public/assets/css/jquery.typeahead.min.css vendored Executable file

File diff suppressed because one or more lines are too long

View file

@ -34248,7 +34248,7 @@ var pieOptions = {
//String - A tooltip template
tooltipTemplate: "<%=value %> <%=label%> "
};
console.dir(pieOptions);
//console.dir(pieOptions);
//Create pie or douhnut chart
// You can switch between pie and douhnut using the method below.
//pieChart.Doughnut(PieData, pieOptions);

File diff suppressed because one or more lines are too long

11
public/assets/js/jquery.typeahead.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View file

@ -34248,7 +34248,7 @@ var pieOptions = {
//String - A tooltip template
tooltipTemplate: "<%=value %> <%=label%> "
};
console.dir(pieOptions);
//console.dir(pieOptions);
//Create pie or douhnut chart
// You can switch between pie and douhnut using the method below.
//pieChart.Doughnut(PieData, pieOptions);

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
{
"assets/css/app.css": "assets/css/app-de75b6d10a.css",
"assets/js/all.js": "assets/js/all-edd914620a.js"
"assets/js/all.js": "assets/js/all-5ba6978224.js"
}

View file

View file

@ -35,7 +35,7 @@ var pieOptions = {
//String - A tooltip template
tooltipTemplate: "<%=value %> <%=label%> "
};
console.dir(pieOptions);
//console.dir(pieOptions);
//Create pie or douhnut chart
// You can switch between pie and douhnut using the method below.
//pieChart.Doughnut(PieData, pieOptions);

View file

@ -7,7 +7,9 @@
@stop
@section('header_right')
<a href="{{ route('create/accessory') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@can('accessories.create')
<a href="{{ route('create/accessory') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@endcan
@stop
{{-- Page content --}}

View file

@ -10,20 +10,28 @@
{{-- Right header --}}
@section('header_right')
<div class="dropdown pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenu1">
@if ($accessory->assigned_to != '')
<li role="presentation"><a href="{{ route('checkin/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.checkin') }}</a></li>
@else
<li role="presentation"><a href="{{ route('checkout/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.checkout') }}</a></li>
@endif
<li role="presentation"><a href="{{ route('update/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.edit') }}</a></li>
@can('accessories.manage')
<div class="dropdown pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenu1">
@if ($accessory->assigned_to != '')
@can('accessories.checkin')
<li role="presentation"><a href="{{ route('checkin/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.checkin') }}</a></li>
@endcan
@else
@can('accessories.checkout')
<li role="presentation"><a href="{{ route('checkout/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.checkout') }}</a></li>
@endcan
@endif
@can('accessories.edit')
<li role="presentation"><a href="{{ route('update/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.edit') }}</a></li>
@endcan
</ul>
</div>
</ul>
</div>
@endcan
@stop
{{-- Page content --}}
@ -64,7 +72,9 @@
<h4>{{ trans('admin/accessories/general.about_accessories_title') }}</h4>
<p>{{ trans('admin/accessories/general.about_accessories_text') }} </p>
<div class="text-center">
@can('accessories.checkout')
<a href="{{ route('checkout/accessory', $accessory->id) }}" style="margin-right:5px;" class="btn btn-info btn-sm" {{ (($accessory->numRemaining() > 0 ) ? '' : ' disabled') }}>{{ trans('general.checkout') }}</a>
@endcan
</div>
</div>

View file

@ -7,7 +7,9 @@
@stop
@section('header_right')
<a href="{{ route('create/component') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@can('components.create')
<a href="{{ route('create/component') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@endcan
@stop
{{-- Page content --}}

View file

@ -10,20 +10,28 @@
{{-- Right header --}}
@section('header_right')
@can('components.manage')
<div class="dropdown pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenu1">
@if ($component->assigned_to != '')
@can('components.checkin')
<li role="presentation"><a href="{{ route('checkin/component', $component->id) }}">{{ trans('admin/components/general.checkin') }}</a></li>
@endcan
@else
@can('components.checkout')
<li role="presentation"><a href="{{ route('checkout/component', $component->id) }}">{{ trans('admin/components/general.checkout') }}</a></li>
@endcan
@endif
@can('components.edit')
<li role="presentation"><a href="{{ route('update/component', $component->id) }}">{{ trans('admin/components/general.edit') }}</a></li>
@endcan
</ul>
</div>
@endcan
@stop

View file

@ -7,7 +7,9 @@
@stop
@section('header_right')
<a href="{{ route('create/consumable') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@can('consumables.create')
<a href="{{ route('create/consumable') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@endcan
@stop
{{-- Page content --}}

View file

@ -24,7 +24,9 @@
<div class="icon">
<i class="fa fa-barcode"></i>
</div>
<a href="{{ route('hardware') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@can('assets.view')
<a href="{{ route('hardware') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@endcan
</div>
</div><!-- ./col -->
@ -38,7 +40,9 @@
<div class="icon">
<i class="fa fa-floppy-o"></i>
</div>
<a href="{{ route('licenses') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@can('licenses.view')
<a href="{{ route('licenses') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@endcan
</div>
</div><!-- ./col -->
@ -52,7 +56,9 @@
<div class="icon">
<i class="fa fa-keyboard-o"></i>
</div>
<a href="{{ route('accessories') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@can('accessories.view')
<a href="{{ route('accessories') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@endcan
</div>
</div><!-- ./col -->
@ -66,7 +72,9 @@
<div class="icon">
<i class="fa fa-tint"></i>
</div>
<a href="{{ route('consumables') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@can('consumables.view')
<a href="{{ route('consumables') }}" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
@endcan
</div>
</div><!-- ./col -->

View file

@ -11,6 +11,7 @@
{{-- Right header --}}
@section('header_right')
@can('assets.manage')
<div class="dropdown pull-right">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{ trans('button.actions') }}
<span class="caret"></span>
@ -27,6 +28,7 @@
<li role="presentation"><a href="{{ route('clone/hardware', $asset->id) }}">{{ trans('admin/hardware/general.clone') }}</a></li>
</ul>
</div>
@endcan
@stop

View file

@ -166,6 +166,7 @@
</div>
</form>
@endcan
@can('admin')
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
@ -173,36 +174,48 @@
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
@can('assets.create')
<li {!! (Request::is('hardware/create') ? 'class="active>"' : '') !!}>
<a href="{{ route('create/hardware') }}">
<i class="fa fa-barcode fa-fw"></i>
@lang('general.asset')</a>
</li>
@endcan
@can('licenses.create')
<li {!! (Request::is('admin/licenses/create') ? 'class="active"' : '') !!}>
<a href="{{ route('create/licenses') }}">
<i class="fa fa-floppy-o fa-fw"></i>
@lang('general.license')</a>
</li>
@endcan
@can('accessories.create')
<li {!! (Request::is('admin/accessories/create') ? 'class="active"' : '') !!}>
<a href="{{ route('create/accessory') }}">
<i class="fa fa-keyboard-o fa-fw"></i>
@lang('general.accessory')</a>
</li>
@endcan
@can('consumables.create')
<li {!! (Request::is('admin/consumables/create') ? 'class="active"' : '') !!}>
<a href="{{ route('create/consumable') }}">
<i class="fa fa-tint fa-fw"></i>
@lang('general.consumable')</a>
</li>
@endcan
@can('users.create')
<li {!! (Request::is('admin/users/create') ? 'class="active"' : '') !!}>
<a href="{{ route('create/user') }}">
<i class="fa fa-user fa-fw"></i>
@lang('general.user')</a>
</li>
@endcan
@can('components.create')
<li {!! (Request::is('admin/components/create') ? 'class="active"' : '') !!}>
<a href="{{ route('create/component') }}">
<i class="fa fa-hdd-o"></i>
@lang('general.component')</a>
</li>
@endcan
</ul>
</li>
@endcan

View file

@ -8,9 +8,11 @@
@section('header_right')
<a href="{{ route('create/licenses') }}" class="btn btn-primary pull-right">
{{ trans('general.create') }}
</a>
@can('licenses.create')
<a href="{{ route('create/licenses') }}" class="btn btn-primary pull-right">
{{ trans('general.create') }}
</a>
@endcan
@stop
{{-- Page content --}}

View file

@ -290,34 +290,41 @@ input[type='text'][disabled], input[disabled], textarea[disabled], input[readonl
</div><!-- /.tab-pane -->
<div class="tab-pane" id="tab_2">
<div class="col-md-10 col-md-offset-2">
@if (!Auth::user()->isSuperUser())
<p class="alert alert-warning">Only superadmins may grant a user superadmin access.</p>
@endif
<?php $counter = 1; ?>
@foreach ($permissions as $area => $permission)
@for ($i = 0; $i < count($permission); $i++)
<?php
$permission_name = $permission[$i]['permission'];
?>
@if ($counter == 2)
<div id="nonadmin">
@endif
@if ($permission[$i]['display'])
<h3>{{ $area }}: {{ $permission[$i]['label'] }}</h3>
<p>{{ $permission[$i]['note'] }}</p>
<!-- radio -->
<div class="form-group" style="padding-left: 15px;">
<label class="radio-padding">
@if (($permission_name == 'superuser') && (!Auth::user()->isSuperUser()))
{{ Form::radio('permission['.$permission_name.']', '1', $userPermissions[$permission_name] == '1', ['class' => 'minimal', 'disabled'=>'disabled']) }}
{{ Form::radio('permission['.$permission_name.']', '1', $userPermissions[$permission_name] == '1', ['disabled'=>'disabled']) }}
@else
{{ Form::radio('permission['.$permission_name.']', '1', $userPermissions[$permission_name] == '1', ['class' => 'minimal']) }}
{{ Form::radio('permission['.$permission_name.']', '1', $userPermissions[$permission_name] == '1', ['class' => "$permission_name"]) }}
@endif
Grant</label>
@ -325,29 +332,36 @@ input[type='text'][disabled], input[disabled], textarea[disabled], input[readonl
<label class="radio-padding">
@if (($permission_name == 'superuser') && (!Auth::user()->isSuperUser()))
{{ Form::radio('permission['.$permission_name.']', '-1', $userPermissions[$permission_name] == '-1', ['class' => 'minimal', 'disabled'=>'disabled']) }}
{{ Form::radio('permission['.$permission_name.']', '-1', $userPermissions[$permission_name] == '-1', ['disabled'=>'disabled']) }}
@else
{{ Form::radio('permission['.$permission_name.']', '-1', $userPermissions[$permission_name] == '-1', ['class' => 'minimal']) }}
{{ Form::radio('permission['.$permission_name.']', '-1', $userPermissions[$permission_name] == '-1', ['class' => "$permission_name"]) }}
@endif
Deny</label>
<label class="radio-padding">
@if (($permission_name == 'superuser') && (!Auth::user()->isSuperUser()))
{{ Form::radio('permission['.$permission_name.']', '0', $userPermissions[$permission_name] =='0', ['class' => 'minimal', 'disabled'=>'disabled']) }}
{{ Form::radio('permission['.$permission_name.']', '0', $userPermissions[$permission_name] =='0', ['disabled'=>'disabled']) }}
@else
{{ Form::radio('permission['.$permission_name.']', '0', $userPermissions[$permission_name] =='0', ['class' => 'minimal']) }}
{{ Form::radio('permission['.$permission_name.']', '0', $userPermissions[$permission_name] =='0', ['class' => "$permission_name"]) }}
@endif
Inherit</label>
</div>
<hr>
@endif
@endfor
@if ($counter == count($permissions))
</div>
@endif
<?php $counter++; ?>
@endforeach
</div>
</div><!-- /.tab-pane -->
</div><!-- /.tab-content -->
<div class="box-footer text-right">
@ -379,8 +393,21 @@ $(document).ready(function() {
<script src="{{ asset('assets/js/pGenerator.jquery.js') }}"></script>
<script>
$(document).ready(function(){
$(".superuser").change(function() {
var perms = $(this).val();
if (perms =='1') {
$("#nonadmin").hide();
} else {
$("#nonadmin").show();
}
});
console.dir($('.superuser'));
$('#genPassword').pGenerator({
'bind': 'click',
'passwordElement': '#password',

View file

@ -15,16 +15,20 @@
@stop
@section('header_right')
@if (\App\Models\Setting::getSettings()->ldap_enabled == 1)
<a href="{{ route('ldap/user') }}" class="btn btn-default pull-right"><span class="fa fa-upload"></span> LDAP</a>
@endif
<a href="{{ route('import/user') }}" class="btn btn-default pull-right" style="margin-right: 5px;"><span class="fa fa-upload"></span> {{ trans('general.import') }}</a>
<a href="{{ route('create/user') }}" class="btn btn-primary pull-right" style="margin-right: 5px;"> {{ trans('general.create') }}</a>
@if (Input::get('status')=='deleted')
<a class="btn btn-default pull-right" href="{{ URL::to('admin/users') }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_current') }}</a>
@else
<a class="btn btn-default pull-right" href="{{ URL::to('admin/users?status=deleted') }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_deleted') }}</a>
@endif
@can('users.create')
@if (\App\Models\Setting::getSettings()->ldap_enabled == 1)
<a href="{{ route('ldap/user') }}" class="btn btn-default pull-right"><span class="fa fa-upload"></span> LDAP</a>
@endif
<a href="{{ route('import/user') }}" class="btn btn-default pull-right" style="margin-right: 5px;"><span class="fa fa-upload"></span> {{ trans('general.import') }}</a>
<a href="{{ route('create/user') }}" class="btn btn-primary pull-right" style="margin-right: 5px;"> {{ trans('general.create') }}</a>
@endcan
@if (Input::get('status')=='deleted')
<a class="btn btn-default pull-right" href="{{ URL::to('admin/users') }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_current') }}</a>
@else
<a class="btn btn-default pull-right" href="{{ URL::to('admin/users?status=deleted') }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_deleted') }}</a>
@endif
@stop
{{-- Page content --}}
@ -43,12 +47,14 @@
'class' => 'form-inline' ]) }}
@if (Input::get('status')!='deleted')
@can('users.delete')
<div id="toolbar">
<select name="bulk_actions" class="form-control select2" style="width: 200px;">
<option value="delete">Bulk Checkin &amp; Delete</option>
</select>
<button class="btn btn-default" id="bulkEdit" disabled>Go</button>
</div>
@endcan
@endif

View file

@ -5,8 +5,8 @@ $I->am('logged in user');
$I->wantTo('ensure that the categories listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/settings/categories');
$I->waitForElement('.table', 5); // secs
$I->seeNumberOfElements('tr', [1,30]);
$I->waitForElement('.table', 10); // secs
$I->seeNumberOfElements('tr', [1,100]);
$I->seeInTitle('Categories');
$I->see('Categories');
$I->seeInPageSource('admin/settings/categories/create');
@ -22,7 +22,7 @@ $I->dontSee('Create Category', '.page-header');
$I->see('Create Category', 'h1.pull-left');
$I->dontSee('&lt;span class=&quot;');
$I->fillField('name', 'testcategory');
$I->fillField('name', \App\Helpers\Helper::generateRandomString(15));
$I->selectOption('form select[name=category_type]', 'Asset');
$I->click('Save');
$I->dontSee('&lt;span class=&quot;');

View file

@ -6,14 +6,13 @@ $I->wantTo('ensure that the users listing page loads without errors');
$I->lookForwardTo('seeing it load without errors');
$I->amOnPage('/admin/users');
//$I->waitForJS("return $.active == 0;", 60);
//$I->waitForElement('.table', 5); // secs
$I->waitForElement('.table', 5); // secs
//$I->seeNumberOfElements('tr', [1,10]);
$I->seeInTitle('Users');
$I->see('Users');
$I->seeInPageSource('admin/users/create');
$I->dontSee('Users', '.page-header');
$I->see('Users', 'h1.pull-left');
$I->seeLink('Create New','/admin/users/create'); // matches <a href="/logout">Logout</a>
/* Create form */