Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selecting which user is login

 
Ahesanali Khanusiya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am making one application in which 3 users are there. I am confused at the time login how can i know that which user is login and which page I have to call and also tell me primary key and foreign key of table. my users are: STUDENT,FACULTY,ADMIN if possible than explain with some example.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we tell you what the primary and foreign keys of your table are?

At login time the person logs in giving (presumably) a username and password--that's how you know who's logging in. They tell you.

Are your *users* "STUDENT", "FACULTY", and "ADMIN", or are those the *types* of users?
 
Ahesanali Khanusiya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes they are types of user...one table of user in which userid-pk and usertype fields another table login in which loginid-pk,username,password and userid-fk third is register in which sign up detail and loginid-fk
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I'm not sure what the question is then.
 
Michael Angstadt
Ranch Hand
Posts: 277
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should have a "users" table in the database with a "role" column that stores whether they are a student, faculty, or admin. Then, when they login, you use the username and password they entered to find the row that represents the user in the table. Use the value of the "role" column to determine what kind of user they are.
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if I understood you right it would be like:


I know the code is ugly but it is just to give you an idea.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic