Skip to content

Commit

Permalink
Fix Role Permission redirection issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-webkul committed Dec 10, 2024
1 parent 69d3cb2 commit 3254cf5
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ public function store()
return redirect()->route('admin.session.create');
}

if (! bouncer()->hasPermission('dashboard')) {
$availableNextMenu = menu()->getItems('admin')?->first();

if (is_null($availableNextMenu)) {
session()->flash('error', trans('admin::app.users.not-permission'));

auth()->guard('user')->logout();

return redirect()->route('admin.session.create');
}

return redirect()->to($availableNextMenu->getUrl());
}

return redirect()->intended(route('admin.dashboard.index'));
}

Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/ar/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'users' => [
'activate-warning' => 'حسابك لم يتم تفعيله بعد. يرجى الاتصال بالمسؤول.',
'login-error' => 'بيانات الاعتماد لا تتطابق مع سجلاتنا.',
'not-permission' => 'ليس لديك إذن للوصول إلى لوحة الإدارة.',

'login' => [
'email' => 'عنوان البريد الإلكتروني',
Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'users' => [
'activate-warning' => 'Your account is not activated yet. Please contact the administrator.',
'login-error' => 'The credentials do not match our records.',
'not-permission' => 'You do not have permission to access the admin panel.',

'login' => [
'email' => 'Email Address',
Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/es/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'users' => [
'activate-warning' => 'Tu cuenta aún no está activada. Por favor, contacta al administrador.',
'login-error' => 'Las credenciales no coinciden con nuestros registros.',
'not-permission' => 'No tienes permiso para acceder al panel de administración.',

'login' => [
'email' => 'Dirección de correo electrónico',
Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/fa/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'users' => [
'activate-warning' => 'حساب شما هنوز فعال نشده است. لطفاً با مدیر سیستم تماس بگیرید.',
'login-error' => 'اطلاعات وارد شده با سوابق ما مطابقت ندارد.',
'not-permission' => 'شما اجازه دسترسی به پنل مدیریت را ندارید.',

'login' => [
'email' => 'آدرس ایمیل',
Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/tr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'users' => [
'activate-warning' => 'Hesabınız henüz etkinleştirilmedi. Lütfen yönetici ile iletişime geçin.',
'login-error' => 'Kimlik bilgileri kayıtlarımızla eşleşmiyor.',
'not-permission' => 'Yönetici paneline erişim izniniz yok.',

'login' => [
'email' => 'E-posta Adresi',
Expand Down
1 change: 1 addition & 0 deletions packages/Webkul/Admin/src/Resources/lang/vi/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'users' => [
'activate-warning' => 'Tài khoản của bạn chưa được kích hoạt. Vui lòng liên hệ quản trị viên.',
'login-error' => 'Thông tin đăng nhập không khớp với hồ sơ của chúng tôi.',
'not-permission' => 'Bạn không có quyền truy cập vào bảng quản trị.',

'login' => [
'email' => 'Địa chỉ Email',
Expand Down

0 comments on commit 3254cf5

Please sign in to comment.