service templates - move to blade - fix permisson lookup

This commit is contained in:
Anthony F McInerney
2020-10-17 21:12:43 +01:00
parent 5ba29d9591
commit c6c1116de9
+20 -5
View File
@@ -184,6 +184,19 @@ class Permissions
return $this->deviceGroupMap[$user_id];
}
/**
* Get a list of id of all service templates the user can access
*
* @param \App\Models\User|int $user
* @return \Illuminate\Support\Collection
*/
public function serviceTemplatesForUser($user = null)
{
return $this->getServiceTemplatePermissions($user)
->where('user_id', $this->getUserId($user))
->pluck('id');
}
/**
* Get the cached data for device permissions. Use helpers instead.
*
@@ -232,15 +245,17 @@ class Permissions
}
/**
* Get a list of id of all service templates the user can access
* Get the cached data for port permissions. Use helpers instead.
*
* @param \App\Models\User|int $user
* @return \Illuminate\Support\Collection
*/
public function serviceTemplatesForUser($user = null)
public function getServiceTemplatePermissions()
{
return $this->getServiceTemplatePermissions($user)
->pluck('id');
if (is_null($this->serviceTemplatePermissions)) {
$this->portPermissions = DB::table('service_templates')->get();
}
return $this->portPermissions;
}
/**