CodeIgniter Forums
flexi auth - A user authentication library for CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: flexi auth - A user authentication library for CodeIgniter (/thread-54581.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34


flexi auth - A user authentication library for CodeIgniter - El Forum - 10-30-2012

[eluser]haseydesign[/eluser]
Hi rtan,

The library includes two features that should help you with defining user roles; user groups and user privileges.

User groups are essentially used as a general category to define the primary role of a user - for example public users, moderator users, editors, etc. - they can be assigned whatever group name that you require. Once a user is assigned to a user group, it is then possible to use functions within the library to check which group the user belongs to, and then perform actions dependent on that group - for example public users could be prevented from accessing an admin only area of the site.

This level of user access detection will likely cover most basic website requirements for user access permissions to sensitive areas of a site.
However, the larger a site gets, the more technical some of the access permissions can get.

For example, lets say within an admin only area of a site, all admin users need to be given read-only access to some sensitive data, this could be easily accomplished by just defining an 'Admin' user group. If then some specific admin users needed to also have write access to this same data, you can no longer rely on the 'Admin' user group to control access, you need to add additional permission checks. This is where the user privileges come in, we can assign the write access permissions to these specific users, without granting the access to all admin users.

By using user groups and privileges together, you can have finer control over user access rights rather than having to create multiple user groups for users potentially having very similar roles.

I hope that helps.


flexi auth - A user authentication library for CodeIgniter - El Forum - 10-30-2012

[eluser]rtan[/eluser]
Hi,

Thanks for the quick reply.

I'm adding user role selection after login and will be needing more guidance.



flexi auth - A user authentication library for CodeIgniter - El Forum - 10-31-2012

[eluser]AJReading[/eluser]
First of all, thanks for this, looks very promising.

First thing I did was change the config to suit my mysql table name conventions, which is to always use "id" as the id column, not prefixed in anyway way...

Anyway, so I do

Code:
$this->flexi_auth->insert_user('[email protected]', '', 'password', array(), FALSE, TRUE);

to get a username in and got the following error:

Code:
Error Number: 1052

Column 'id' in where clause is ambiguous

SELECT `email`, `activation_token` FROM (`user_accounts`) LEFT JOIN `user_groups` ON `user_accounts`.`group_id` = `user_groups`.`id` WHERE `id` = 4 GROUP BY `id`

Filename: /home/supplementdb.co.uk/htdocs/dev/models/flexi_auth_lite_model.php

Line Number: 163

Looks like your query is not specifying the table name in the group by clause.

Anyway simple fix on flexi_auth_lite_model.php line: #152

Code:
$this->db->group_by(.$this->auth->tbl_col_user_account['id']);
to
Code:
$this->db->group_by($this->auth->tbl_user_account.'.'.$this->auth->tbl_col_user_account['id']);



flexi auth - A user authentication library for CodeIgniter - El Forum - 10-31-2012

[eluser]AJReading[/eluser]
Actually it seems I'm having that issue with most of the queries. If you are going to give the ability to change the columns in the config file then the queries should really include table names to avoid the problem of ambiguous columns.



flexi auth - A user authentication library for CodeIgniter - El Forum - 10-31-2012

[eluser]haseydesign[/eluser]
@AJReading

You make a very valid point, I'll look into updating the library ASAP.
Thanks


flexi auth - A user authentication library for CodeIgniter - El Forum - 11-01-2012

[eluser]Unknown[/eluser]
Question : I am using your product and everything works fine. Accept..

I have a grid (Wijmo) that calls a controller to get the data.
In the constructor of the controller I have this code.

Quote: if (!$this->input->is_ajax_request()) {
if (! $this->flexi_auth->is_logged_in())
{
// Set a custom error message.
$this->flexi_auth->set_error_message('You must login to access your climate zones.', TRUE);
$this->session->set_flashdata('message', $this->flexi_auth->get_messages());
redirect('auth');
}
}

Data is received. But after that I am automatically logged out...

What am I doing wrong ?



flexi auth - A user authentication library for CodeIgniter - El Forum - 11-01-2012

[eluser]haseydesign[/eluser]
@RaoulHuisman

It's not possible for me to know the exact problem your having with the code snippet that you have posted.

All that code is doing is checking that the page was not loaded via ajax and that the user is not logged in. In which case it sets an error message to CI's session flash data and redirects to the controller auth. I'm presuming you already knew all that - but that's all I've got to go on.

The problem is most likely a configuration problem, maybe from your installation of the library, or something directly within your controller.
To confirm whether its your config, try installing the demo, if it works correctly you can be sure its a problem within your setup.

I would suggest to debug the problem you could create a new CI installation, run through the flexi auth installation guide - line by line - and then try and create a minimalist version of the page you are trying to create now.
Once this is working, then compare it will your current effort and find out what does not match up.


flexi auth - A user authentication library for CodeIgniter - El Forum - 11-01-2012

[eluser]AJReading[/eluser]
haseydesign: thanks, I did start this myself but I'm sure it's a quicker and easier job for you being more familiar with the code. Any chance of a reply on here when you've done it? Keen to start using it Wink. Cheers


flexi auth - A user authentication library for CodeIgniter - El Forum - 11-02-2012

[eluser]chibuzor[/eluser]
Flexi auth library for codeigniter has been very useful, but I have a problem,

After login, it flashes "Login Successful" message but does not redirect to the backend as set, instead, it redirects to the login page.

I think something is killing the session as soon as it is set...please what could be the cause of this


flexi auth - A user authentication library for CodeIgniter - El Forum - 11-02-2012

[eluser]haseydesign[/eluser]
@AJReading

I've updated the flexi auth library so that all SQL statements now use column names prefixed with table names.

This was a large update in terms of the amount of code that had to be updated, so whilst I have tested the library via the demo examples, there could be a bug or two that may have been introduced with the update. So if something is misbehaving, let us know and I'll check it out.

The update is available via the Github repo. The only files that need updating are the model and library files.