Scope to company when viewing assets (#2315)
* If a user doesn't belong to a company, when scoping to a company we should only show items that don't belong to a company. * Scope tables/items to the company they belong to when fetching items for the index. * Fix asset count to also scope to company. This fixes dashboard view * Exempt super users from the child company check to be consistent. Fixes license count on dashboard now that we scope everything
This commit is contained in:
@@ -410,8 +410,8 @@ class ComponentsController extends Controller
|
||||
**/
|
||||
public function getDatatable()
|
||||
{
|
||||
$components = Component::select('components.*')->whereNull('components.deleted_at')
|
||||
->with('company', 'location', 'category');
|
||||
$components = Company::scopeCompanyables(Component::select('components.*')->whereNull('components.deleted_at')
|
||||
->with('company', 'location', 'category'));
|
||||
|
||||
if (Input::has('search')) {
|
||||
$components = $components->TextSearch(Input::get('search'));
|
||||
|
||||
Reference in New Issue
Block a user