Using shield, How i can redirect to separate url if the user not in admin group |
Hello,
I'm working with codeigniter shield package for authorization and i want to restrict normal user to access the administration controllers which is not in admin group. but everything works perfect, it redirects to index page if the user not in admin group. but i want to to redirect them to seperate page instead of redirecting to the index page. Below is my code in Routes.php Code: $routes->group("admin", ["namespace" => "\Admin\Controllers", "filter" => "group:admin"], static function ($routes) { How i can redirect to seperate page ? Thanks
CodeIgniter 4 Shield User Guide - Authentication Flow
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
We have the following solution to transfer the user if he belongs to a certain group or permission, after login. But I think that is not what you mean.
https://codeigniter4.github.io/shield/cu...n-redirect What I understand is that you want the following feature to be added to the shield. https://github.com/codeigniter4/shield/p...1375755217
I tried afterPermissionDenied but that does not work
Everything works and showing the error " You do not have the necessary permission to perform the desired operation." if the user is not admin and accessing the administrator routes. but i want to change the redirect index to other routes. (08-15-2023, 11:26 PM)datamweb Wrote: We have the following solution to transfer the user if he belongs to a certain group or permission, after login. But I think that is not what you mean. (08-16-2023, 01:30 AM)datamweb Wrote:(08-16-2023, 12:08 AM)sknair143 Wrote: I tried afterPermissionDenied but that does not work How i can do this another way i just using filter=>"group:admin" inb routes (08-16-2023, 01:33 AM)sknair143 Wrote: How i can do this another way i just using filter=>"group:admin" inb routes See: https://github.com/codeigniter4/shield/p...1046458048 By changing: https://github.com/codeigniter4/shield/b...er.php#L41 (08-16-2023, 01:46 AM)datamweb Wrote:(08-16-2023, 01:33 AM)sknair143 Wrote: How i can do this another way i just using filter=>"group:admin" inb routes So if i change directly to the core file it will get removed if future updates come in the package right ?
Yes exactly, for this reason it is not recommended to do this.
|
Welcome Guest, Not a member yet? Register Sign In |