diff --git a/Changelog b/Changelog index 9aa5d6b14..8881cee25 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-08-02 DariusIII + * Fix: Fix API v1 response, wrong data used for function * Chg: Update updateUserRoles script to account for users with missing roles * Chg: Allow moderator role to edit releases, fixes issue #123 * Chg: Update updateUserRoles.php script with new moderator 'edit release' permission diff --git a/app/Http/Controllers/Api/ApiController.php b/app/Http/Controllers/Api/ApiController.php index 981e13bac..58dda509a 100644 --- a/app/Http/Controllers/Api/ApiController.php +++ b/app/Http/Controllers/Api/ApiController.php @@ -14,10 +14,6 @@ use App\Http\Controllers\BasePageController; class ApiController extends BasePageController { - public function __construct(Request $request) - { - parent::__construct($request); - } /** * @param \Illuminate\Http\Request $request @@ -84,7 +80,7 @@ class ApiController extends BasePageController } } - if (User::isDisabled($res['username'])) { + if (User::isDisabled($res['id'])) { Utility::showApiError(101); } diff --git a/routes/api.php b/routes/api.php index 7a1e5d92a..2801aef72 100644 --- a/routes/api.php +++ b/routes/api.php @@ -12,22 +12,17 @@ | */ -Route::prefix('v1')->group(function () { - Route::namespace('Api')->group(function () { +Route::group(['prefix' => 'v1', 'namespace' => 'Api'], function () { Route::get('api', 'ApiController@api'); Route::post('api', 'ApiController@api'); - }); }); -Route::prefix('v2')->group(function () { - Route::namespace('Api')->group(function () { +Route::group(['prefix' => 'v2', 'namespace' => 'Api'], function () { Route::get('capabilities', 'ApiV2Controller@capabilities'); Route::post('capabilities', 'ApiV2Controller@capabilities'); - }); }); -Route::prefix('v2')->middleware('auth:api', 'throttle:rate_limit,1')->group(function () { - Route::namespace('Api')->group(function () { +Route::group(['prefix' => 'v2', 'namespace' => 'Api', 'middleware' => ['auth:api', 'throttle:rate_limit,1']], function () { Route::get('movies', 'ApiV2Controller@movie'); Route::post('movies', 'ApiV2Controller@movie'); Route::get('search', 'ApiV2Controller@search'); @@ -38,5 +33,4 @@ Route::prefix('v2')->middleware('auth:api', 'throttle:rate_limit,1')->group(func Route::post('getnzb', 'ApiV2Controller@getNzb'); Route::get('details', 'ApiV2Controller@details'); Route::post('details', 'ApiV2Controller@details'); - }); });