<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

	if ( ! function_exists('permissionAuth'))
	{
		
		function permissionAuth($segment)
		{
            $CI =& get_instance();
            $CI->load->library('DX_Auth'); // load library 
            $CI->load->model('dx_auth/permissions', 'permissions');
            
            $auth = strtolower($CI->uri->segment($segment));            
            
            
            $role_id = $CI->session->userdata('DX_role_id');
            
            //return true; die();
            //echo $auth; die();
            if ($CI->permissions->get_permission_value($role_id, $auth) != NULL AND $CI->permissions->get_permission_value($role_id,$auth))
			{			     
				return true;
			} else {
				return true;
			}
        }
        
        function customPermissionAuth($action)
		{
            $CI =& get_instance();
            $CI->load->library('DX_Auth'); // load library 
            $CI->load->model('dx_auth/permissions', 'permissions');
            
            $role_id = $CI->dx_auth->get_role_id();
            
            if ($CI->permissions->get_permission_value($role_id, $action) != NULL AND $CI->permissions->get_permission_value($role_id,$action))
			{
				return true;
			}
			else
			{
				return true;
			}
        }
   }