Welcome Guest, Not a member yet? Register   Sign In
MeNeedz Auth
#81

[eluser]ray73864[/eluser]
oh?

hrmm, now that i have updated the auth library, the
Code:
$this->auth->has_access('admin')
is returning false.

i was hoping to use the login capabilities from the database but the group capabilities just from an array for now.
#82

[eluser]davidbehler[/eluser]
Yeah, I rely on the database and input config arrays to be complete. If you copy them only partially to your config file, then they are incomplete and that's when errors like yours can occur. It shouldn't happen in most cases but to be sure, just keep the arrays intact.
#83

[eluser]ray73864[/eluser]
ok, updated the config/auth.php file so that it now looks like:

Code:
$config['input_config'] = array(
        'login' =>     array(
                'identifier' => 'username', //name of the input that holds the identifier used for login
                'password' => 'password', //name of the input that holds the password used for login
                'remember' => 'remember_me' //name of the checkbox that says wether to remember the user or not
            ),
        'register' =>     array(
                'identifier' => 'user_name', //name of the input that holds the identifier used for registration
                'password' => 'user_password', //name of the input that holds the password used for registration
                'email' => 'user_email', //name of the input that holds the email used for registration (only needed if use_email is set to TRUE),
                'primary_key' => 'user_id' //value of the primary key column in the user table, only needed if it is not set to auto increment
            )
    );
    
    $config['database_config'] = array(
        'user_table' => array(
            'name' => 'fa_user',
            'user_primary_key_column' => 'ID',
            'user_primary_key_column_is_auto_increment' => true,
            'user_identifier_column' => 'username',
            'user_password_column' => 'password',
            'user_salt_column' => '',
            'group_foreign_key_column' => 'group_id'
        ),
        'group_table' =>    array(
                'name' => 'group', //name of the group table
                'group_primary_key_column' => 'group_id', //name of the column that holds the primary key thats referenced in other tables
                'group_level_column' => 'group_level' //name of the column with the access level of the group
            ),
        'right_table' =>    array(
                'name' => 'right', //name of the right table
                'group_foreign_key_column' => 'group_id', //column with the group
                'controller_column' => 'controller', //column with the controller
                'function_column' => 'function', //column with the function
                'access_right_column' => 'access_right' //column with the granted rights
            ),
        'member_table' => array (
            'name' => 'member',
            'group_foreign_key_column' => 'group_id',
            'user_foreign_key_column' => 'user_id'
        )
    );
    
    $config['encryption_order'] = '%password%';
    $config['non_database_user_groups'] = array('user' => 1, 'moderator' => 10, 'admin' => 100);
    $config['non_database_user_group_rights'] = array('access_rights' => 'r',
                                                        'admin' => array('access_rights' => 'rwd'),
                                                        'moderator' => array('access_rights' => 'rw')
                                                );
    
    $config['use_database'] = TRUE;
    $config['use_database_user_groups'] = FALSE;
    $config['use_database_rights'] = FALSE;

I have also updated the missing column from my fa_user table (added group_id in)

however the has_access('admin') is returning false (it sees me as logged in since the controller does that check), and instead of showing me my admin section it shows me a print_r() of get_user()
#84

[eluser]davidbehler[/eluser]
Try adding this to your config file:
Code:
$config['use_database_multi_user_groups'] = FALSE;
#85

[eluser]ray73864[/eluser]
still not working with the has_access().

is there any way that i can have it where i use the member_table for multiple group levels for a user, but get the groups from an array instead of the database?

update: worked it out, i decided to use the database for everything (not using the rights at present), could you perhaps post examples of how to use this library in it's fullest?
#86

[eluser]davidbehler[/eluser]
What do you mean by "use this library in it's fullest"? An example for everyway possible to use the library?
#87

[eluser]ray73864[/eluser]
not for every possible way, just examples of how to use it, so people can see how to deal with groups for instance, you have an example at the bottom of the user guide for the 'rights', but the groups was never really covered much at all in the user guide.
#88

[eluser]davidbehler[/eluser]
Ok, I have added a section on user group configuration. I hope that helps Smile

To answer your question from before: Yes you can use the array for user groups and the database for membership management. Just set the following in your config file:
Code:
$config['use_database_multi_user_groups'] = TRUE;
$config['use_database_user_groups'] = FALSE;
#89

[eluser]ray73864[/eluser]
thanks for that, tis a lot clearer now.

in my 'group' table, i have the groups defined the same as the array, so the primary key has the names 'user', 'moderator' and 'admin'.

in my 'member' table, i assume that means i have to have the 'group_id' set to the same thing, i do anyway and it works, just double checking.
#90

[eluser]davidbehler[/eluser]
Yes, that's the way it's supposed to work




Theme © iAndrew 2016 - Forum software by © MyBB