Beautiful Open-Source Form Builder
update imporsonation routes (#477)
Chirag Chhatralab11f41d8b6b2
diff --git a/app/Http/Middleware/ImpersonationMiddleware.php b/app/Http/Middleware/ImpersonationMiddleware.phpindex 89c3baf6b..a1b194a89 100644--- a/app/Http/Middleware/ImpersonationMiddleware.php+++ b/app/Http/Middleware/ImpersonationMiddleware.php@@ -36,6 +36,9 @@ class ImpersonationMiddleware'open.forms.regenerate-link','open.forms.submissions','open.forms.submissions.file',+ 'open.providers',+ 'open.forms.integrations',+ 'open.forms.integrations.events',// Workspaces'open.workspaces.index',@@ -66,7 +69,7 @@ class ImpersonationMiddlewarepublic function handle(Request $request, Closure $next){try {- if (! auth()->check() || ! auth()->payload()->get('impersonating')) {+ if (!auth()->check() || !auth()->payload()->get('impersonating')) {return $next($request);}} catch (JWTException $e) {@@ -75,7 +78,7 @@ class ImpersonationMiddleware// Check that route is allowed$routeName = $request->route()->getName();- if (! in_array($routeName, self::ALLOWED_ROUTES)) {+ if (!in_array($routeName, self::ALLOWED_ROUTES)) {return response(['message' => 'Unauthorized when impersonating','route' => $routeName,@@ -85,7 +88,7 @@ class ImpersonationMiddleware'payload' => $request->all(),], 403);} elseif (in_array($routeName, self::LOG_ROUTES)) {- \Log::warning(self::ADMIN_LOG_PREFIX.'Impersonator action', [+ \Log::warning(self::ADMIN_LOG_PREFIX . 'Impersonator action', ['route' => $routeName,'url' => $request->fullUrl(),'impersonated_account' => auth()->id(),diff --git a/routes/api.php b/routes/api.phpindex b65150fdf..089bfd5db 100644--- a/routes/api.php+++ b/routes/api.php@@ -68,7 +68,7 @@ Route::group(['middleware' => 'auth:api'], function () {});Route::prefix('open')->name('open.')->group(function () {- Route::get('/providers', [OAuthProviderController::class, 'index'])->name('index');+ Route::get('/providers', [OAuthProviderController::class, 'index'])->name('providers');Route::get('/forms', [FormController::class, 'indexAll'])->name('forms.index-all');Route::get('/forms/{slug}', [FormController::class, 'show'])->name('forms.show');