CodeIgniter Forums
EzAuth 0.6 - The Easiest User Management System for CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: EzAuth 0.6 - The Easiest User Management System for CI (/showthread.php?tid=5686)

Pages: 1 2 3 4 5


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 12-29-2008

[eluser]mdriscol[/eluser]
I tried the extend library class described in the linked post. I even edited the Session class directly and changed the affected lines but it still didn't fix it. I still get the same error when trying to log into ez_auth. How did you get it to work??


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 12-29-2008

[eluser]JulianM[/eluser]
Hi mdriscol,

I made exactly the same as Brant explains in his post.

For your convenience, I just put this code in MY_Session.php file under libraries.

Code:
<?php
if (! defined('BASEPATH'))
    exit('No direct script access allowed');
/**
* PHP Template.
*
* http://www.avnetlabs.com/php/two-step-view-with-codeigniter
*/

class MY_Session extends CI_Session
{

    function MY_Validation ()
    {
        parent::CI_Session();
    }

    // --------------------------------------------------------------------
    


    /**
     * Serialize an array
     *
     * This is a copy of the original from 1.7.0
     * This is a bug fix for handling objects in a session
     * REF: http://ellislab.com/forums/viewthread/95690/
     *
     * This function first converts any slashes found in the array to a temporary
     * marker, so when it gets unserialized the slashes will be preserved
     *
     * @access  private
     * @param   array
     * @return  string
     */
    function _serialize ($data)
    {
        if (is_array($data))
        {
            foreach ($data as $key => $val)
            {
                if (! is_object($val))
                    $data[$key] = str_replace('\\', '{{slash}}', $val);
            }
        } else
        {
            $data = str_replace('\\', '{{slash}}', $data);
        }
        
        return serialize($data);
    }

    // --------------------------------------------------------------------
    


    /**
     * Unserialize
     *
     * This function unserializes a data string, then converts any
     * temporary slash markers back to actual slashes
     *
     * @access    private
     * @param    array
     * @return    string
     */
    function _unserialize ($data)
    {
        $data = @unserialize(strip_slashes($data));
        
        if (is_array($data))
        {
            foreach ($data as $key => $val)
            {
                if (! is_object($val))
                    $data[$key] = str_replace('{{slash}}', '\\', $val);
            }
            
            return $data;
        }
        
        return str_replace('{{slash}}', '\\', $data);
    }
}

?>





[quote author="mdriscol" date="1230605086"]I tried the extend library class described in the linked post. I even edited the Session class directly and changed the affected lines but it still didn't fix it. I still get the same error when trying to log into ez_auth. How did you get it to work??[/quote]


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 02-22-2009

[eluser]flogiston[/eluser]
Hi,

Had the same problem and looked a bit deeper. The problem lies in the mysql driver: it incorrectly adds backticks(`) arround the '*' so MySQL thinks '*' is the name of a field.

SELECT `ez_users`.`id` as id, `ez_users`.`*`, `ez_auth`.`activation_code` FROM ...
should be
SELECT `ez_users`.`id` as id, `ez_users`.*, `ez_auth`.`activation_code` FROM ...

I modified the file "system\database\drivers\mysql\mysql_driver.php", function _escape_identifiers (line 441) so it only escapes the table name, not the '*':
I basically changed line 441 from
Code:
$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
to

Code:
if($this->_endsWith($item, '.*'))
{
   $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.', $item);            
} else
{
   $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;            
}
I also added the function _endsWith below the function _escape_identifiers:
Code:
function _endsWith($haystack, $needle){
   return strrpos($haystack, $needle) === strlen($haystack)-strlen($needle);
}

I know we shouldn't be modifying the core, but this seems to be a bug in the mysql_driver IMHO as it generates invalid sql.

HTH


[quote author="mdriscol" date="1230605086"]I tried the extend library class described in the linked post. I even edited the Session class directly and changed the affected lines but it still didn't fix it. I still get the same error when trying to log into ez_auth. How did you get it to work??[/quote]


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 02-25-2009

[eluser]Biktor[/eluser]
Does this extension is discontinued?

I have a problem, with this in my _remap method

Code:
$auth = $this->auth->authorize($method, false);

Firefox gives the error:

Code:
This page is not redirecting properly

Firefox has detected that the server is redirecting the request to this address in a way that will never end.

I have my protected_pages properly fitted but only works when the code is

Code:
$auth = $this->auth->authorize($method, true);

But in this case each time the user accesses a controller's method inserts a key into the database.

Does anyone anything happens?


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 02-25-2009

[eluser]JulianM[/eluser]
Can you please provide further information about your environment?
- Which CodeIgniter version are you using?
- Are you in Apache? Linux or Windows?

Julian Magnone

[quote author="Biktor" date="1235631513"]Does this extension is discontinued?

I have a problem, with this in my _remap method

Code:
$auth = $this->auth->authorize($method, false);

Firefox gives the error:

Code:
This page is not redirecting properly

Firefox has detected that the server is redirecting the request to this address in a way that will never end.

I have my protected_pages properly fitted but only works when the code is

Code:
$auth = $this->auth->authorize($method, true);

But in this case each time the user accesses a controller's method inserts a key into the database.

Does anyone anything happens?[/quote]


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 02-25-2009

[eluser]Biktor[/eluser]
Thanks for the fast response.

My codeigniter is Version 1.7
I'm in Apache in Windows Xp SP2....


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 02-25-2009

[eluser]JulianM[/eluser]
Hi,

This is my _remap function in a base controller class (MY_Controller). I placed the _remap in a base controller so I don't need to re-write it on each class.

Please check you are not redirecting to the same every time the authorization = false. If it don't work, can you please give me further information about how you are using it?


Quote: // new remap function in 0.6, method is called including arguments now
function _remap($method) {
$auth = $this->ezauth->authorize($method, true);
if ($auth['authorize'] == true) {
// redirect with method arguments
// by marlar on CodeIgniter forums
$segments = array_slice($this->uri->segment_array(),2);
call_user_func_array(array(&$this, $method), $segments);
} else {
// user login information incorrect, so show login screen again
redirect('user/login');
}
}


[quote author="Biktor" date="1235634716"]Thanks for the fast response.

My codeigniter is Version 1.7
I'm in Apache in Windows Xp SP2....[/quote]


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 02-26-2009

[eluser]flogiston[/eluser]
Hi Biktor,

Just make sure that your login page is not protected:
$this->ezauth->protected_pages of your login controller should not contain "all" or "login".

HTH

[quote author="Biktor" date="1235631513"]Does this extension is discontinued?

I have a problem, with this in my _remap method

Code:
$auth = $this->auth->authorize($method, false);

Firefox gives the error:

Code:
This page is not redirecting properly

Firefox has detected that the server is redirecting the request to this address in a way that will never end.

I have my protected_pages properly fitted but only works when the code is

Code:
$auth = $this->auth->authorize($method, true);

But in this case each time the user accesses a controller's method inserts a key into the database.

Does anyone anything happens?[/quote]


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 02-26-2009

[eluser]Biktor[/eluser]
Last night was something molten, checked again today and found that the model ez_auth referred to as the acces_keys to an object, but in my session are as Array, then never found the keys of user access.

The problem is solved!

Many thanks for the fast help!


EzAuth 0.6 - The Easiest User Management System for CI - El Forum - 09-19-2009

[eluser]CARP[/eluser]
Hi people
The "access keys" in EzAuth could be called as "another way of ACL" ?