EllisLab text mark
Advanced Search
69 of 89
69
   
Ion Auth - Lightweight Auth System based on Redux Auth 2
Posted: 14 August 2011 10:42 AM   [ # 1031 ]   [ Rating: 0 ]
Joined: 2011-05-17
28 posts

I’m guessing that since you didn’t reply to the offer of assistance, you aren’t looking for any?

 
Posted: 14 August 2011 12:12 PM   [ # 1032 ]   [ Rating: 0 ]
Joined: 2011-08-14
2 posts

Hi,

I was just wondering whether I would be able to change the hashing routine in my install. Is it just a function in the library or is it scattered all over the place?

Joseph

 
Posted: 15 August 2011 12:05 PM   [ # 1033 ]   [ Rating: 0 ]
Avatar
Joined: 2009-07-26
823 posts

michaelh99,

Definitely up for assistance.  Just send me a pull request for any updates you have. 

Thanks!

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

 
Posted: 15 August 2011 12:06 PM   [ # 1034 ]   [ Rating: 0 ]
Avatar
Joined: 2009-07-26
823 posts

jszym,

It’s just a method that can be changed easily.

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

 
Posted: 15 August 2011 06:46 PM   [ # 1035 ]   [ Rating: 0 ]
Joined: 2011-08-14
2 posts

Thanks Ben,

Just to be clear, it’s located in the Ion Auth model, right? (I’ve substituted it for a bcrypt implementation :D)

jszym

 
Posted: 16 August 2011 07:46 PM   [ # 1036 ]   [ Rating: 0 ]
Avatar
Joined: 2009-07-26
823 posts

jszym,

That is correct.

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

 
Posted: 18 August 2011 06:04 AM   [ # 1037 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-25
6 posts

Using Ion 2

Small problem, first the function $this->ion_auth->is_group($group) should be in_group().
I think I remember seeing this elsewhere. However a problem exists if you pass an array of groups.

Currently is_group returns in_array($check_group, $groups) which won’t work if check_group is an array.

Solution:
application/libraries/Icon_auth.php

Add condition to check if $check_groups is an array and if it is then walk through the array checking for a match.

public function in_group($check_group)
{
$this
->ci->ion_auth_model->trigger_events('is_group');

    
$users_groups $this->ci->ion_auth_model->get_users_groups();
    
$groups = array();
    foreach (
$users_groups as $group)
    
{
        $groups[] 
$group->name;
    
}
    $permission 
false;
    if(
is_array($check_group)) {
        
foreach($check_group as $key => $value){
            
if(in_array($value$groups)) {
                $permission 
true;
            
}
        }
    } 
else {
        
if(in_array($check_group$groups)) {
            $permission 
true;
        
}
    }
    
return $permission;

Otherwise love your work

 Signature 

Working with Drupal is like building a boat but starting with a car!

 
Posted: 19 August 2011 10:09 AM   [ # 1038 ]   [ Rating: 0 ]
Avatar
Joined: 2009-07-26
823 posts

Kevin,

Thanks dude, that looks awesome.  Can you send me a pull request on github?  In travelling this weekend so if you do that I can merge it from my phone, thanks!

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

 
Posted: 19 August 2011 04:36 PM   [ # 1039 ]   [ Rating: 0 ]
Avatar
Joined: 2008-07-08
12 posts

I was just poking around in the code for Ion_auth 2. I love how the library has been refactored and streamlined. But I do have a question. What exactly does trigger_events() do?

 
Posted: 19 August 2011 11:54 PM   [ # 1040 ]   [ Rating: 0 ]
Avatar
Joined: 2009-07-26
823 posts

ammonkc,

trigger_events() will call all the hooks that were set with the set_hook() method.

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

 
Posted: 20 August 2011 01:38 PM   [ # 1041 ]   [ Rating: 0 ]
Avatar
Joined: 2010-05-21
23 posts

Does anyone have any suggestions on the best way to implement an online user list/chat (based on Ion Auth of course)?

The chat is straight forward, and not too much trouble.

The online list is what’s causing a bit of pain (As I want to display an on line list of admins, It’s just the ‘how’ do you distinguish an ‘online’ user and how is that status stored.)

If anyone’s implemented such things in their projects, I’d be interested in hearing how you went about it.

Thank you

 Signature 

Thanks,
Andy!

 
Posted: 20 August 2011 04:43 PM   [ # 1042 ]   [ Rating: 0 ]
Joined: 2011-05-15
15 posts

Hi Ben,
thanks a lot for your work! I’m currently doing some studies in overloading methods and I would like your comments on my observations of your work, to help me in my learning curve.

I’m writting to you, because I’ve been reading your library and in the first lines of code I’ve noticed that you declared a overloading method __call() to minimize the effort to call ion_auth_model methods. While we can understand and confirm it from __call() body code, the truth is that you don’t actually use it afterwards. My question is, why ? After checking more code I realised that this had to be with name collisions.

At line 117, we have method __call() defined,

/**
     * __call
     *
     * Acts as a simple way to call model methods without loads of stupid alias'
     *
     **/
    
public function __call($method$arguments)
    
{
        
if (!method_exists$this->ci->ion_auth_model$method) )
        
{
            
throw new Exception('Undefined method Ion_auth::' $method '() called');
        
}

        
return call_user_func_array( array($this->ci->ion_auth_model$method), $arguments);
    

You see, the code is very readable, but right then you have,

/**
     * Activate user.
     *
     * @return void
     * @author Mathew
     **/
    
public function activate($id$code=false)
    
{
        
if ($this->ci->ion_auth_model->activate($id$code))
        
{
            $this
->set_message('activate_successful');
            return 
TRUE;
        
}

        $this
->set_error('activate_unsuccessful');
        return 
FALSE;
    

I’ve been wondering why did you bothered to wrote __call ?

Thanks for looking wink

 
Posted: 20 August 2011 07:52 PM   [ # 1043 ]   [ Rating: 0 ]
Avatar
Joined: 2009-07-26
823 posts

We use call for a lot of methods that aren’t defined in the library.  If we need to do something extra in the library we just define it and call the model in that method.

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

 
Posted: 27 August 2011 03:30 PM   [ # 1044 ]   [ Rating: 0 ]
Joined: 2010-02-23
34 posts

found a bug in V2, in /controllers/auth.php

line 119:  $user = $this->ion_auth->get_user($this->session->userdata(‘user_id’));
change to: $user = $this->ion_auth->user($this->session->userdata(‘user_id’))->row();

 
Posted: 29 August 2011 10:08 AM   [ # 1045 ]   [ Rating: 0 ]
Avatar
Joined: 2011-08-28
139 posts

Dear, Ben,.... I’m new on this, I’ve send you an e mail which ask how to get username in ion_auth 2.4.0
I wonder, why should you delete the feature of get user profile from ion_auth (although it is possible to get it from database and session)

Since I don’t know what the reason is, I add this code to ion_auth_model.php :

/**
         * get_user
         *
         * @return array
         * @author goFrendiAsgard
         **/
        
public function get_profile($id=FALSE)
        {
                
                
//if no id was passed use the current users id
                
$id || $id $this->session->userdata('user_id');

                return 
$this->db->select('username, email')
                                  ->
where('id'$id)
                                  ->
get($this->tables['users'])
                                  ->
row_array();
        

Do you think it is okay to add this method on the next release (sorry, it is just an suggestion), I need to show “Welcome user” on my page,....

Also, IMHO you should delete this, since I can’t see any purpose to keep it there,....

/**
     * Profile
     *
     * @TODO want to get rid of this
     * @return void
     * @author Mathew
     **/
    
public function profile()
    {
        $this
->ci->ion_auth_model->trigger_events('profile');
        
        
$session  $this->ci->config->item('identity''ion_auth');
        
$identity $this->ci->session->userdata($session);

        return 
$this->ci->ion_auth_model->profile($identity);
    

Thank you Ben, I like your ion_auth, it saves my times,.....

 Signature 

Homepage : http://www.getnocms.com
Github page : https://github.com/goFrendiAsgard/No-CMS

A free CodeIgniter based CMS-Framework, It is not just another CMS !!!

 
69 of 89
69