authenticate against a secondary users table

20 views
Skip to first unread message

shartha

unread,
Jun 9, 2013, 10:48:54 PM6/9/13
to web...@googlegroups.com
Hello. In a situation with two (or more) groups of users, for instance in an application where companies post jobs, and job seekers search for jobs, if I have two separate tables for companies and job seekers, how can I use the authentication that is shipped with with web2py? Users sign up to the website as either a job seeker, or a company, but I'd like to have one input form for their login (The application needs to check against both tables).

Any help would be appreciated.

Thanks.

Anthony

unread,
Jun 10, 2013, 12:19:50 AM6/10/13
to
The Auth system is really designed to have one instance (and one auth_user table) per application. Your best bet is probably to use a single user table and just add a "user_type" field indicating the type of user. If you need different profile fields for each type, you can include all the fields in the table and selectively set the readable/writable attributes of the fields depending on the type of user (you can also have separate linked tables for each user type). You'll need to do some customizing of the registration and profile actions to deal with the different groups.

Another option is to create a separate app to handle the registration and authentication of one of the groups and use CAS.

Anthony

Annet

unread,
Jun 10, 2013, 2:09:10 AM6/10/13
to web...@googlegroups.com
I had a similar problem to solve and tried several solutions. The one that worked best for me is a 'super' table 'node' and 'sub' tables 'organization', 'person' and 'groups' (groups because group is a reserved word) and in the auth_user table a field referencing the id of table 'node'. Table node contains a field 'subID' which indicates whether the node is an organization, a person or a group.


Annet
Reply all
Reply to author
Forward
0 new messages