diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 73aeb2a993..c683dbf917 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -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] [] + * @since [v4.4.2] + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function getCurrentUserInfo(Request $request) + { + return response()->json($request->user()); + } } diff --git a/routes/api.php b/routes/api.php index 97c032caa6..c66c388820 100644 --- a/routes/api.php +++ b/routes/api.php @@ -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',