aspose file tools
The moose likes Java in General and the fly likes what design pattern is good for this scenario ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "what design pattern is good for this scenario ?" Watch "what design pattern is good for this scenario ?" New topic
Author

what design pattern is good for this scenario ?

ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 369
Wants to design a GUI that shows students' grades. When a student logs in, he can see his grades but can't change; an instructor logs in he can see and enter/modify grades; when an administrative staff loggs, he can see and delete student grades after the student leaves school but he can't modify or enter grades.

what design pattern is for such thing ?
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3327

I don't think you need a specific design pattern for this situation.

Its all about RBAC (Role Based Access Control), which you can handle it programatically by checking the user's status/permissions and decide on the action.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
One common model is a user has 0..n roles. Each role has 0..n permissions. Make a permission for anything one user can do and another cannot. The existence of a permission, say "Modify Grades", in the user's tree means he can do that.

A more complex model has an access control object instead of permission. It might Grant or Deny rights to Create, Read, Update, Delete, Execute etc on every restricted thing. Some systems take the "most restrictive" result, so if a user has Grant Modify Grades in one role and Deny Modify Grades in another, the Deny wins.

Any of that sound right for your requirements?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
ben oliver
Ranch Hand

Joined: Mar 28, 2006
Posts: 369
Originally posted by Stan James:
One common model is a user has 0..n roles. Each role has 0..n permissions. Make a permission for anything one user can do and another cannot. The existence of a permission, say "Modify Grades", in the user's tree means he can do that.

A more complex model has an access control object instead of permission. It might Grant or Deny rights to Create, Read, Update, Delete, Execute etc on every restricted thing. Some systems take the "most restrictive" result, so if a user has Grant Modify Grades in one role and Deny Modify Grades in another, the Deny wins.

Any of that sound right for your requirements?


I like the idea of "Access control object", could you talk more and give an example to explian it ?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: what design pattern is good for this scenario ?
 
Similar Threads
Keep getting this error and not sure why
TreeMap
Socket Programming in Java (Newbie)
Creating a method to average grades out
Averaging Grades Assignment