Welcome Guest, Not a member yet? Register   Sign In
DX Auth Question about user types
#1

[eluser]JulianM[/eluser]
I am trying to use DX Auth in my application and I need to separate different types of users. Not only by role but by having different table for each role.

admin
-----
first name
last name
user_id

supervisor
----------
company name
address
user_id

user_id may be a foreign key to DXAuth's users table.

I want to know your opinion about if it is possible to use DX Auth for this purpose. I am not sure if copying the user_profile model is a good idea for implement a solution.

Any clue or hint would be very much appreciated.
#2

[eluser]TheFuzzy0ne[/eluser]
Please could you explain why you need a different table for each role? I'd imagine they all have the same fields, so you should only need one table, with an extra field for role id, and another table for roles, and another for permissions (groups and users). I hope this helps.
#3

[eluser]JulianM[/eluser]
Hi, thank you for your reply.

The main reason is that I should separate different fields for supervisor and admin. (They should not share the same fields that is why only one table is not affordable)

For example, supervisor needs a company name while admin needs to have first_name and last_name.

[quote author="TheFuzzy0ne" date="1242333031"]Please could you explain why you need a different table for each role? I'd imagine they all have the same fields, so you should only need one table, with an extra field for role id, and another table for roles, and another for permissions (groups and users). I hope this helps.[/quote]
#4

[eluser]theshiftexchange[/eluser]
Hmmm... to be sounds like you need to re-design your database.

You should have "users" with first/last names etc.

The users can be either Admins or Supervisors or general users

You can then have another table of user ids, supervisors, and link that with companies.
#5

[eluser]JulianM[/eluser]
Hi theshiftexchange, thank you for your response.

I am in progress of design the database, my concern is that I am new using DX Auth and probably this situation happened before (I have used other auth libraries before).

DX Auth has a users table that fits ok for me. It do not have first_name nor last_name and that makes sense for me (since these fields are more like user_profile and not user itself). It only have the user required fields such as username, email, last_login, etc.

Moreover, user_profile table has the other fields (firstname, lastname, city, etc.)

So, if I should have normal Users (instead of Admin or Supervisors) I may use user_profile for store the user data, just as DX Auth examples do.

In my case, I have Admin and Supervisor, not Users (each entity with different fields), so I thought in using a similar approach (instead of user_profile, having supervisor_profile and admin_profile).

I still want to use the libraries facilities, that is my big concern (I don't want to re-invent the wheel).

Any with previous experience on DX Auth seems this approach makes sense?

Thanks.

Julian


[quote author="theshiftexchange" date="1242383052"]Hmmm... to be sounds like you need to re-design your database.

You should have "users" with first/last names etc.

The users can be either Admins or Supervisors or general users

You can then have another table of user ids, supervisors, and link that with companies.[/quote]
#6

[eluser]theshiftexchange[/eluser]
I use Tank Auth (which is a cut down verion of DX Auth).

You should have 1x User_Profile for each User in the table. User_Profile is just an extension of the User table, but split to make things easier.

So you will have lots of Users - each will have a User_Profile. In the User_Profile you can add custom information fields you need, such as security level, admin level etc.

The psuedo coding is something like this:

a person registers on your website
User table created with "username, email and password". Store the UserID
User_profile table created with "firstname, lastname, etc etc, AND the "UserID" that was generated from the users table

This means you can do lookups for users, and also for their user_profile table.




Theme © iAndrew 2016 - Forum software by © MyBB