mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
service templates - move to blade - fix permisson lookup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user