Merge pull request #16837 from grokability/fmcs_scoping_improvements
Small improvements to scoped views
This commit is contained in:
commit
2b9cf1663b
4 changed files with 15 additions and 3 deletions
|
@ -5,6 +5,8 @@ namespace App\Http\Controllers\Api;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Transformers\ActionlogsTransformer;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Company;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
|
@ -18,10 +20,11 @@ class ReportsController extends Controller
|
|||
*/
|
||||
public function index(Request $request) : JsonResponse | array
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$this->authorize('activity.view');
|
||||
|
||||
$actionlogs = Actionlog::with('item', 'user', 'adminuser', 'target', 'location');
|
||||
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$actionlogs = $actionlogs->TextSearch(e($request->input('search')));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class LocationPresenter extends Presenter
|
|||
'switchable' => true,
|
||||
'title' => trans('general.company'),
|
||||
'visible' => false,
|
||||
'formatter' => 'locationCompanyObjFilterFormatter'
|
||||
'formatter' => 'companiesLinkObjFormatter'
|
||||
],
|
||||
[
|
||||
'field' => 'name',
|
||||
|
|
|
@ -168,6 +168,15 @@ class AuthServiceProvider extends ServiceProvider
|
|||
}
|
||||
});
|
||||
|
||||
// -----------------------------------------
|
||||
// Activity
|
||||
// -----------------------------------------
|
||||
Gate::define('activity.view', function ($user) {
|
||||
if (($user->hasAccess('reports.view')) || ($user->hasAccess('admin'))) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// -----------------------------------------
|
||||
// Self
|
||||
// -----------------------------------------
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
|
||||
@if ($snipeSettings->full_multiple_companies_support=='1')
|
||||
@if ((($snipeSettings->scope_locations_fmcs!='1') && ($snipeSettings->full_multiple_companies_support=='1')))
|
||||
<!-- Companies -->
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
|
|
Loading…
Add table
Reference in a new issue