mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 05:47:28 -08:00
Implemented method to get info on the current user of the API (#5722)
* Implemented method to get info on the current user of the API * Move userinfo method to UsersController * Added missing files
This commit is contained in:
parent
8732f299e6
commit
311f9fcefb
|
@ -320,4 +320,17 @@ class UsersController extends Controller
|
|||
return response()->json(['message' => 'No ID provided'], 500);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get info on the current user.
|
||||
*
|
||||
* @author [Juan Font] [<juanfontalonso@gmail.com>]
|
||||
* @since [v4.4.2]
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getCurrentUserInfo(Request $request)
|
||||
{
|
||||
return response()->json($request->user());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -674,10 +674,10 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () {
|
|||
|
||||
|
||||
|
||||
|
||||
/*--- Users API ---*/
|
||||
|
||||
|
||||
|
||||
|
||||
Route::group([ 'prefix' => 'users' ], function () {
|
||||
|
||||
Route::post('two_factor_reset',
|
||||
|
@ -687,6 +687,13 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () {
|
|||
]
|
||||
);
|
||||
|
||||
Route::get('me',
|
||||
[
|
||||
'as' => 'api.users.me',
|
||||
'uses' => 'UsersController@getCurrentUserInfo'
|
||||
]
|
||||
);
|
||||
|
||||
Route::get('list/{status?}',
|
||||
[
|
||||
'as' => 'api.users.list',
|
||||
|
|
Loading…
Reference in a new issue