benedmunds / CodeIgniter-Ion-Auth

Simple and Lightweight Auth System for CodeIgniter
http://benedmunds.com/ion_auth/
MIT License
2.35k stars 1.14k forks source link

is there a way to use different table for the same project? #516

Closed singleseeker closed 10 years ago

singleseeker commented 10 years ago

i use ion-auth for a long time. thanks for this perfect code.

here is a question.

i hope the manage system and front user system use different tables.use groups is a good way to let manager or user have different laval, but i really do not want to make them in a same table.

if there is a way to load different configs and put different identify in session in order that separate manage system and user system.

benedmunds commented 10 years ago

You could dynamically change the config settings using CIs config library.

-Ben Edmunds

On Oct 29, 2013, at 8:36 PM, SingleSeeker notifications@github.com wrote:

i use ion-auth for a long time. thanks for this perfect code.

here is a question.

i hope the manage system and front user system use different tables.use groups is a good way to let manager or user have different laval, but i really do not want to make them in a same table.

if there is a way to load different configs and put different identify in session in order that separate manage system and user system.

— Reply to this email directly or view it on GitHubhttps://github.com/benedmunds/CodeIgniter-Ion-Auth/issues/516 .

singleseeker commented 10 years ago

ok, got it. thank u.

singleseeker commented 10 years ago

even I load a different config.

i also need to change the code , isn`t right?

it will not allowed me to make both front user and mange user login together if i do not change the following code. what i am thinking, why not add a pre-fix(from config file) for the following code.

$session_data = array(
            'identity'             => $user->{$this->identity_column},
            'username'             => $user->username,
            'email'                => $user->email,
            'user_id'              => $user->id, //everyone likes to overwrite id so we'll use user_id
            'old_last_login'       => $user->last_login
        );

becomes

$session_data = array(
            $pre_fix . 'identity'             => $user->{$this->identity_column},
            $pre_fix . 'username'             => $user->username,
            $pre_fix . 'email'                => $user->email,
            $pre_fix . 'user_id'              => $user->id, //everyone likes to overwrite id so we'll use user_id
            $pre_fix . 'old_last_login'       => $user->last_login
        );

what do u think?

nathanpitman commented 10 years ago

+1

:)

benedmunds commented 10 years ago

So you want a user to be a manager and a normal user at once?

benedmunds commented 10 years ago

This really sounds like something you should just use groups for..

singleseeker commented 10 years ago

sometimes we do not want the manager and normal user were stored in a same table.

benedmunds commented 10 years ago

I dont really think this is a good idea so I'm going to close this. I get that you want it and I'm glad you found a way to make it work but I think it would just be confusing to the majority of users of the library.

I'll make sure to point people to this issue if anyone else needs this in the future. Thanks.