mirror of
https://github.com/snipe/snipe-it.git
synced 2025-10-29 19:31:41 +00:00
add auth to api call, gave more specificity to the relationship
This commit is contained in:
parent
68c082e0dc
commit
e2e54677ee
@ -748,6 +748,8 @@ class UsersController extends Controller
|
||||
*/
|
||||
public function eulas(User $user, ActionlogsTransformer $transformer)
|
||||
{
|
||||
$this->authorize('view', Asset::class);
|
||||
|
||||
$eulas = $user->eulas;
|
||||
return response()->json(
|
||||
$transformer->transformActionlogs($eulas, $eulas->count())
|
||||
|
||||
@ -562,6 +562,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
{
|
||||
return $this->hasMany(Actionlog::class, 'target_id')
|
||||
->with('item')
|
||||
->select(['id', 'target_id', 'target_type', 'action_type', 'filename', 'accept_signature', 'created_at'])
|
||||
->where('target_type', self::class)
|
||||
->where('action_type', 'accepted')
|
||||
->whereNotNull('filename')
|
||||
|
||||
@ -1094,7 +1094,7 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'api-throttle:api']], fu
|
||||
]
|
||||
)->name('api.users.me');
|
||||
|
||||
Route::get('/users/{user}/eulas',
|
||||
Route::get('{user}/eulas',
|
||||
[
|
||||
Api\UsersController::class,
|
||||
'eulas'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user