CodeIgniter Forums
Datamapper user..what auth library do you use? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Datamapper user..what auth library do you use? (/showthread.php?tid=50788)



Datamapper user..what auth library do you use? - El Forum - 04-09-2012

[eluser]Mantero[/eluser]
for datamapper user, what authentication library did you use?

I still can't figure auth how to integrate existing library such as Tank auth with datamapper




Datamapper user..what auth library do you use? - El Forum - 04-09-2012

[eluser]WanWizard[/eluser]
There is really no need to integrate anything.

The only thing you need to do (if you want to access the auth tables inside your application) is to create models for those tables. Which would require the table layout to be Datamapper compliant.

I know IonAuth works, have no experience with Tank.


Datamapper user..what auth library do you use? - El Forum - 04-09-2012

[eluser]Mantero[/eluser]
[quote author="WanWizard" date="1333972376"]There is really no need to integrate anything.

The only thing you need to do (if you want to access the auth tables inside your application) is to create models for those tables. Which would require the table layout to be Datamapper compliant.

I know IonAuth works, have no experience with Tank.[/quote]



the problem is Tank Auth already has a default User table in database, and default Users model which extends CI_Model


my question is, how do I define a Datamapper model for User table?


thanks for your help


Datamapper user..what auth library do you use? - El Forum - 04-09-2012

[eluser]WanWizard[/eluser]
Yes, so?

As long as that Users table has a primary key called 'id', you can create a Datamapper model for it.

Code:
class Randomname extends Datamapper
{
    public $table = 'Users';
}

// and then

$users = new Randomname():
$users->where('username', 'John')->get();