From 45a0e0e9dea06582e33047be0d79a524d5e1711e Mon Sep 17 00:00:00 2001 From: MatteoF96 Date: Thu, 24 Nov 2022 10:16:30 +0100 Subject: [PATCH] Fixed prefix for REST APIs --- docs/install/configuration-options.md | 6 +++++- src/User/Bootstrap.php | 1 + src/User/Module.php | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/install/configuration-options.md b/docs/install/configuration-options.md index 2c5a74b..f448a70 100755 --- a/docs/install/configuration-options.md +++ b/docs/install/configuration-options.md @@ -333,7 +333,11 @@ Default value = `yii\filters\auth\QueryParamAuth` class, therefore access tokens #### adminRestPrefix (type: `string`, default: `user/api/v1`) -Route prefix for REST admin controller. +Prefix for the pattern part of every rule for REST admin controller. + +#### adminRestRoutePrefix (type: `string`, default: `user/api/v1`) + +Prefix for the route part of every rule for REST admin controller. #### adminRestRoutes (type `array`) diff --git a/src/User/Bootstrap.php b/src/User/Bootstrap.php index ddace61..6ff6967 100755 --- a/src/User/Bootstrap.php +++ b/src/User/Bootstrap.php @@ -291,6 +291,7 @@ class Bootstrap implements BootstrapInterface $config = [ 'class' => 'yii\web\GroupUrlRule', 'prefix' => $module->adminRestPrefix, + 'routePrefix' => $module->adminRestRoutePrefix, 'rules' => $rules, ]; $rule = Yii::createObject($config); diff --git a/src/User/Module.php b/src/User/Module.php index 9cd0bd9..5151abe 100755 --- a/src/User/Module.php +++ b/src/User/Module.php @@ -260,9 +260,13 @@ class Module extends BaseModule */ public $authenticatorClass = 'yii\filters\auth\QueryParamAuth'; /** - * @var string Route prefix for REST admin controller. + * @var string Prefix for the pattern part of every rule for REST admin controller. */ public $adminRestPrefix = 'user/api/v1'; + /** + * @var string Prefix for the route part of every rule for REST admin controller. + */ + public $adminRestRoutePrefix = 'user/api/v1'; /** * @var array Routes for REST admin controller. */