CodeIgniter Forums
Get the requested method - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Get the requested method (/showthread.php?tid=26121)



Get the requested method - El Forum - 01-06-2010

[eluser]RobertSall[/eluser]
Hey.

I've made a authfunction that's being called in the MY_Controller class. In every controller I have an array with permissions for each function in the controller:
var $permissions = array( 'index' => array('member') );
(Example)

Then in the function I check the segment 2 which method was requested (if none index was requested) and then check if the user's usergroup is in the permissionsarray.

So far so good, it works as I want to, but the problem is when I want to use routing, then segment 2 wont contain the requested method..

I've searched for another way to find another way to get which method was requested.

Any ideas?

Thanks


Get the requested method - El Forum - 01-06-2010

[eluser]Sbioko[/eluser]
You can retrieve current method using this:
Code:
$this->router->fetch_method();



Get the requested method - El Forum - 01-06-2010

[eluser]RobertSall[/eluser]
Works, thank you.