Connecting Tech Pros Worldwide Forums | Help | Site Map

which solution u advising me to use for login system

Newbie
 
Join Date: May 2009
Posts: 15
#1: May 27 '09
hi, i don't know if there is a design pattern for this, but this is the case:
my java application to manage players, coaches, teams and matches.

only one administrator is allowed to add, change of delete players, teams ..
and only users with high permission are allowed to add matches or delete them from the database.

i was thinking about this solution:

add a new table to my DB: tblusers
user_id, user, password, privilege level

Expand|Select|Wrap|Line Numbers
  1. if (user.getPrivilegeLevel == x){
  2.   // delete, insert, .. 
  3. }
but this is a lot of work, to add this control to all classes alle methodes in dataacces layer and business layer, don't u think that?

thx & kr
e

dmjpro's Avatar
Lives Here
 
Join Date: Jan 2007
Location: India (West-Bengal)
Posts: 2,451
#2: May 27 '09

re: which solution u advising me to use for login system


Well...You can have three tables.
users{
user_id (primary_key),
password,
user_details ... addresses/contact info ....etc
};

programs{
program_id (primary_key),
program_details ..if any
};

and

user_accesses{
program_id (foreign key -> program_id of programs)
user_id (foreign key -> user_id of users),
acess_details ... insert(Y/N),update(Y/N)...etc
};.

First and last tables are obvious.
But the middle one ... which program? ;)
Basically it refers to your pages to be used by the users.
So by using joining these three tables you can get all the privileges of an user for a particular page/program.
Newbie
 
Join Date: May 2009
Posts: 15
#3: May 27 '09

re: which solution u advising me to use for login system


i'm gonne think about that solution
thank u
Reply