ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

DX Auth 1.0.6 (Authentication library)

December 01, 2008 6:14am

Subscribe [160]
  • #316 / Jan 24, 2009 8:38am

    Hartimer

    20 posts

    Hi everyone. My first post yey 😊

    Getting to the point, I’ve been experimenting with CI, I’m really digging it.. since most sites use auth systems i checked some and here i am.

    I have 2 questions:

    1st. I understand that there is an “is_admin()” function and the “is_role” function, so we can limit access to a resource. Since this is based on CI Auth, is there anything like defining which directories are available for which role(s)?
    Instead of having in each controller “is_role(array(“professor”, “assistent”)” just have “has_permission(segment)” for instance?

    EDIT: Found the “backend/uri_permissions/” thingy :x lol

    2nd. This is just a minor detail, but shouldn’t there exist a foreign_key restriction on table “users”? Regarding “role_id”? Its just for the sake of consistency..

    Did i mentioned this is a great lib?

    Hugs

  • #317 / Jan 24, 2009 8:17pm

    jcavard

    130 posts

    EDIT: Found the “backend/uri_permissions/” thingy :x lol

    Right what I was looking for, thx!

    Did i mentioned this is a great lib?

    CI is awesome!

  • #318 / Jan 25, 2009 12:52pm

    Hartimer

    20 posts

    Is there any way to obtain a user’s id without that user being logged in?

    In the website I’m building the admin (me) creates the accounts for the users, email as username, random pass, email with activation code, generated pass etc.

    This all works like a charm, but the problem is, i have a relation between my client’s table and dx_auth users table, so, when creating a user’s account i want to populate my table with the dx_auth user table user_id, but register only returns TRUE/FALSE.

    I can make a quick query and find this out, since usernames are unique, but i was wondering if there were any method which does this, like a “get_user_id(username/address)”?


    Another question, regarding uri_permissions.

    Is there anyway to give permissions to a directory of controllers?

    i have a folder called ‘client’, which has controller ‘A’ and ‘B’ (and will get further populated).
    Giving permissions to ‘/client/’ does not work, since uri_permission is based on uri->rsegment and not uri->segment.
    I don’t want to have to add each controller by hand ‘/A/’ ‘/B/’ specially because there are controllers with the same name but in different folders (which MUST have different access restrictions). Adding ‘/A/’ will cause for ‘client/A’ to be accessible as well as ‘admin/A’..

    Is there any workaround?

  • #319 / Jan 25, 2009 9:10pm

    otn3m3m

    20 posts

    Hi,

    I have a problem with dx_auth library. When a user logs into the website and then closes the browser the user is shown as still logged in next time they browse to the site. Even though I specify that the remember me parameter of the login function is set to false.

    Any help would be appreciated.

    thanks

    V

  • #320 / Jan 26, 2009 12:29am

    umefarooq

    690 posts

    Can i use DX Auth with Modular extension if so any example, i already tried my self its gives me the following error.

    An Error Was Encountered

    Unable to locate the file: .php in: views/

    right now i calling register function here is my url

    http://localhost/code/index.php/admin/auth/register

    any solution.

  • #321 / Jan 26, 2009 5:07pm

    mocsa1

    3 posts

    Hi Guys,

    Does anybody happen to know how was the documentation for DX Auth generated. It looks exactly the same as CodeIgniter’s. I hope there is a tool which can generate in a format like that.

    Thanks

  • #322 / Jan 27, 2009 3:31pm

    umefarooq

    690 posts

    hi im trying to use the this library but facing this problem i tried to login its give me the following error

    A Database Error Occurred
    Error Number: 1064
    
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `ip_address` = '127.0.0.1'' at line 2
    
    SELECT 1 WHERE `ip_address` = '127.0.0.1'

    table name is missing in the query.

  • #323 / Jan 28, 2009 12:12am

    OliverHR

    137 posts

    Please include user guide documentation in download.

  • #324 / Jan 28, 2009 2:20pm

    JayArias

    45 posts

    Question how can I use the session information on my pages

    eg

    $_SESSION['emailadress']

    I would Like to do the following

    <?php if($_SESSION['logged_in'])
    {
     echo "link";
    }else{
     echo "non-member link";
    }?>
  • #325 / Jan 28, 2009 2:27pm

    Hartimer

    20 posts

    Question how can I use the session information on my pages

    eg

    $_SESSION['emailadress']

    I would Like to do the following

    <?php if($_SESSION['logged_in'])
    {
     echo "link";
    }else{
     echo "non-member link";
    }?>

    You do have a is_logged_in() method..

    You could use something like

    <?php if($this->dx_auth->is_logged_in())
    {
     echo "link";
    }else{
     echo "non-member link";
    }?>

    if you MUST use $_SESSION may alter the “login” (and logout) method of dx_auth so when logging in it would register the session variable..

    As for email (dx_auth email at least) i believe they have an entry on the session lib of CI itself..

    $this->session->dx_auth_email;

    Not sure about the real names of the methods/varaibles, I don’t have access to the lib right now, so i can’t be more specific.. hope it helps though

  • #326 / Jan 28, 2009 2:34pm

    JayArias

    45 posts

    Message: Undefined property: CI_Loader::$dx_auth
  • #327 / Jan 28, 2009 2:43pm

    JayArias

    45 posts

    Fixed it

    $autoload['libraries'] = array('DX_Auth','DX_Auth_Event');

    Question is now , which was still not answered. “How do I pull information from my users table from the logged in user”.

  • #328 / Jan 28, 2009 5:18pm

    JayArias

    45 posts

    anyone?

  • #329 / Jan 28, 2009 5:33pm

    Hartimer

    20 posts

    Fixed it

    $autoload['libraries'] = array('DX_Auth','DX_Auth_Event');

    Question is now , which was still not answered. “How do I pull information from my users table from the logged in user”.

    You should really check the documentation.

    You have session info like

    echo $this->session->userdata('DX_username');
    echo $this->session->userdata('DX_role_name');

    You can also use the model from dx_auth, which has methods such as “get_profile($user_id)”.
    (and yes u have to load the models)

  • #330 / Jan 31, 2009 2:19am

    samseko

    16 posts

    i have some simple checks to see if someone is logged in and provide a link to the Profile and Logout page. If they are not logged in, a Login and Register link is provided. And if i am logged in, an addition Admin link is provided.

    If i log in and tick the check box to remember me, everything is fine if i close the browser and open it up in a short space of time. That is, it remembers i am logged in and the relevant links are displayed.

    I am having an issue where if i close the browser and open it up after a long period of time ( such as the next day ) i am logged in but the ‘$this->session->userdata(‘user’) == ‘sam’) appears not to catch the fact i am logged in via a cookie session. I can verify that the Admin side of it is functional though.

    Any fix for this?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases