CodeIgniter Forums
Function level authentication - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Function level authentication (/thread-45763.html)



Function level authentication - El Forum - 10-05-2011

[eluser]rtan[/eluser]
Hi,

I'm authenticating users in core\MY_controller.php in construct()
using code
Code:
if (!$this->ion_auth->logged_in())
further in a class I'm authorizing functions as
Code:
class Bills extends MY_Controller {
function __construct()
{
parent::__construct();
$c = $this->uri->rsegment(1); // The Controller
$f = $this->uri->rsegment(2); // The Function  
if (!($this->_allowed_function($c,$f))
{  
   redirect('auth/no_access');  
}
I am using Dynamic_menu.php with tables dyn_menu and function_mapping to generate drop down menu specific to login\role.

Now my issue is that there are a few functions, which I need to call through forms submission, and also AJAX requests, how do I authenticate these.

Thanks in advance.