Access denied
+Your account does not have the permission required to open this page. Ask an administrator to verify your assigned role and its permissions.
+ Return to HMS +diff --git a/app/Config/Auth.php b/app/Config/Auth.php index c3f8242..d84bd34 100644 --- a/app/Config/Auth.php +++ b/app/Config/Auth.php @@ -78,8 +78,8 @@ class Auth extends ShieldAuth 'login' => '/', 'logout' => 'login', 'force_reset' => '/', - 'permission_denied' => '/', - 'group_denied' => '/', + 'permission_denied' => 'access-denied', + 'group_denied' => 'access-denied', ]; /** diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 52ea8a2..0cc1b2a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -6,6 +6,7 @@ use CodeIgniter\Router\RouteCollection; * @var RouteCollection $routes */ $routes->get('/', 'Home::index'); +$routes->get('access-denied', 'Home::accessDenied'); $routes->get('dashboard', 'Home::dashboard'); $routes->get('dashboard/opd', 'Home::opdDashboard'); $routes->get('dashboard/ipd', 'Home::ipdDashboard'); diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index e05c57f..6bee846 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -34,6 +34,18 @@ class Home extends BaseController ]); } + public function accessDenied() + { + $authRedirect = $this->ensureAuthenticated(); + if ($authRedirect !== null) { + return $authRedirect; + } + + return $this->response + ->setStatusCode(403) + ->setBody(view('errors/html/access_denied')); + } + public function billing() { $authRedirect = $this->ensureAuthenticated(); diff --git a/app/Views/errors/html/access_denied.php b/app/Views/errors/html/access_denied.php new file mode 100644 index 0000000..b41051d --- /dev/null +++ b/app/Views/errors/html/access_denied.php @@ -0,0 +1,53 @@ + + +
+ + +Your account does not have the permission required to open this page. Ask an administrator to verify your assigned role and its permissions.
+ Return to HMS +