This commit is contained in:
snipe 2016-08-02 00:54:38 -07:00
parent 27adeb427e
commit 8246a319a2
21 changed files with 484 additions and 193 deletions

View file

@ -19,6 +19,7 @@ use Str;
use View; use View;
use Auth; use Auth;
use Request; use Request;
use Gate;
/** This controller handles all actions related to Accessories for /** This controller handles all actions related to Accessories for
* the Snipe-IT Asset Management application. * the Snipe-IT Asset Management application.
@ -591,7 +592,21 @@ class AccessoriesController extends Controller
$rows = array(); $rows = array();
foreach ($accessories as $accessory) { 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; $company = $accessory->company;
$rows[] = array( $rows[] = array(
@ -654,10 +669,20 @@ class AccessoriesController extends Controller
$rows = array(); $rows = array();
foreach ($accessory_users as $user) { 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( $rows[] = array(
'name' =>(string) link_to('/admin/users/'.$user->id.'/view', e($user->fullName())), 'name' => $name,
'actions' => $actions 'actions' => $actions
); );
} }

View file

@ -40,6 +40,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use TCPDF; use TCPDF;
use View; use View;
use Carbon\Carbon; use Carbon\Carbon;
use Gate;
/** /**
* This class controls all actions related to assets for * This class controls all actions related to assets for
@ -1547,7 +1548,18 @@ class AssetsController extends Controller
$inout = ''; $inout = '';
$actions = ''; $actions = '';
if ($asset->deleted_at=='') { 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=='') { } 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>'; $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>';
} }
@ -1555,9 +1567,15 @@ class AssetsController extends Controller
if ($asset->assetstatus) { if ($asset->assetstatus) {
if (($asset->assetstatus->deployable != 0) && ($asset->deleted_at=='')) { if (($asset->assetstatus->deployable != 0) && ($asset->deleted_at=='')) {
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) { 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 { } 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 View;
use Validator; use Validator;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Gate;
/** /**
* This class controls all actions related to Components for * This class controls all actions related to Components for
@ -454,7 +455,23 @@ class ComponentsController extends Controller
$rows = array(); $rows = array();
foreach ($components as $component) { 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; $company = $component->company;
$rows[] = array( $rows[] = array(

View file

@ -18,6 +18,7 @@ use Redirect;
use Slack; use Slack;
use Str; use Str;
use View; use View;
use Gate;
/** /**
* This controller handles all actions related to Consumables for * This controller handles all actions related to Consumables for
@ -444,7 +445,23 @@ class ConsumablesController extends Controller
$rows = array(); $rows = array();
foreach ($consumables as $consumable) { 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; $company = $consumable->company;
$rows[] = array( $rows[] = array(

View file

@ -23,6 +23,7 @@ use Config;
use Session; use Session;
use App\Helpers\Helper; use App\Helpers\Helper;
use Auth; use Auth;
use Gate;
/** /**
* This controller handles all actions related to Licenses for * This controller handles all actions related to Licenses for
@ -983,7 +984,26 @@ class LicensesController extends Controller
$rows = array(); $rows = array();
foreach ($licenses as $license) { 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( $rows[] = array(
'id' => $license->id, 'id' => $license->id,

View file

@ -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> '; $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', if (!is_null($user->deleted_at)) {
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> '; 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 { } else {
if ($user->accountStatus() == 'suspended') { if (Gate::allows('users.delete')) {
$actions .= '<a href="' . route('unsuspend/user', if ($user->accountStatus() == 'suspended') {
$user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> '; $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', $actions .= '<a href="' . route('clone/user',
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> '; $user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
}
$actions .= '<a href="' . route('clone/user', if (Gate::allows('users.delete')) {
$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',
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) { $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 data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user', } else {
$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 .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
}
} else { } 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>'; $actions .= '</nobr>';
$rows[] = array( $rows[] = array(

View file

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

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

View file

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

View file

@ -7,7 +7,9 @@
@stop @stop
@section('header_right') @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 @stop
{{-- Page content --}} {{-- Page content --}}

View file

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

View file

@ -7,7 +7,9 @@
@stop @stop
@section('header_right') @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 @stop
{{-- Page content --}} {{-- Page content --}}

View file

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

View file

@ -7,7 +7,9 @@
@stop @stop
@section('header_right') @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 @stop
{{-- Page content --}} {{-- Page content --}}

View file

@ -24,7 +24,9 @@
<div class="icon"> <div class="icon">
<i class="fa fa-barcode"></i> <i class="fa fa-barcode"></i>
</div> </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>
</div><!-- ./col --> </div><!-- ./col -->
@ -38,7 +40,9 @@
<div class="icon"> <div class="icon">
<i class="fa fa-floppy-o"></i> <i class="fa fa-floppy-o"></i>
</div> </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>
</div><!-- ./col --> </div><!-- ./col -->
@ -52,7 +56,9 @@
<div class="icon"> <div class="icon">
<i class="fa fa-keyboard-o"></i> <i class="fa fa-keyboard-o"></i>
</div> </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>
</div><!-- ./col --> </div><!-- ./col -->
@ -66,7 +72,9 @@
<div class="icon"> <div class="icon">
<i class="fa fa-tint"></i> <i class="fa fa-tint"></i>
</div> </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>
</div><!-- ./col --> </div><!-- ./col -->

View file

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

View file

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

View file

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

View file

@ -354,7 +354,7 @@ input[type='text'][disabled], input[disabled], textarea[disabled], input[readonl
@endfor @endfor
@if ($counter == count($permissions)) @if ($counter == count($permissions))
POOP
</div> </div>
@endif @endif
<?php $counter++; ?> <?php $counter++; ?>

View file

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