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

Thank you!!!!! Ciao!!!!

No prob!

Anything else you need?
Something that you don't like about my library?

[eluser]Référencement Google[/eluser]
From your user guide example:
header("location: ".$this->config->site_url().'/welcome/login');

Better use CI redirect:

Also, where in your code is PHP5?
class Auth
    var $CI = null;
    var $user_table = "user";
    var $user_identifier_column = "user_name";
    var $user_password_column = "user_password";
    var $user_salt_column = "user_salt";
    var $user_group_column = "user_group";
    var $use_database = TRUE;
    var $non_database_user_identifier = "";
    var $non_database_user_password = "";
    var $use_encryption = TRUE;
    var $encryption_method = "md5";
    var $encryption_order = "%salt%.%password%";
    var $user_identifier_input_name = "user_name";
    var $user_password_input_name = "user_password";
    var $user = FALSE;
    var $user_groups = array('user' => '1', 'moderator' => '10', 'admin' => '100');
    var $use_remember_me = FALSE;
    var $remember_me_input_name = "remember_me";

    var $_encryption_methods = array('md5', 'sha', 'sha1');
    var $_encryption_elements = array('%salt%', '%password%');

    function Auth($config = array())
           ... etc...

Your code is also a bit of spaghetti coding without any comments. That makes it real difficult to understand, and I am sure there would be a lot lot lot of things to improve in it, first of separate the DB code in a model, flag some long successions of if / else tests instead of returning each time something.

Also I don't understand why this mixture of post code without any validation of the form. Why not just use some validation then? That said, I personally think an auth lib shouldn't mix things like you did. Keep it simple, just do auth process in this lib and add some extended class to do other things, keep it structured.

Sorry about criticism, it's to be constructive...

one thing i would like to see this support (i don't know how viable it would be though), is if the group levels could be defined in the database and if a user could be assigned to more than one group.

for instance you might have a cms where a particular user can manage the pages on the website and also manage the forums (if it has forums) but not be able to do other things on the site such as change the site settings.

probably a silly example but i think it conveys the point across.

one thing i do like about this system is the integration capabilities with a CMS, for instance a person could add an extra column into the table that stores the pages saying what groups have access to what pages.

i assume you can have several groups with the same level?

[eluser]Référencement Google[/eluser]
ray73864 what you want is more about permissions than auth.

[eluser]Colin Williams[/eluser]
Good stuff. Reading through some features, I was delighted to see some of the features of my personal auth/user library, including an open object model, authenticate on any identifier, configurable encryption, etc. We go about it in different ways, but cool nonetheless. I think this is the right way to go with contributions: Provide useful conventions but allow for enough configuration to meet unique needs.

Several groups with the same level is no problem.

Right now I am working on a way to restrict access based on group, controller and function. By using a static array that's pretty easy but if I want to offer the same function by using database it's much more complicated. Well..maybe not more complicated but less user friendly because now I require a certain layout of your database. You can still call the columns/tables what you want but the basic layout must follow some rules for me being able to use it.

@Pixel: I think permissions and authentication are related and can be offered in one library without hesitation. But I can totally see why one would put them in different librarys.

@Colin: Glad to hear you like it. Would you mind telling me in what sense you do stuff differently?

@ray: I have updated the library to suite your needs. Users can now be either member of a single group or as many groups as you want using an additional table. Caused by these additions I needed to do some major changes to the library. You definetly have to edit your config, have a look at the user guide how to setup your database config. Basically all database related settings, like the names of the columns/tables went to one big array instead of several single variables. Shouldn't be too much trouble to adapt your current config to the new way.

I have updated the archive and the user guide and both can be downloaded/view using the links provided in the first post of this thread.

Have fun Smile

nice, i especially like how you have still managed to maintain the functionality and flexibility of your system while providing for these new features.

Awesome library. Good job!

Theme © iAndrew 2016 - Forum software by © MyBB