I'm building a webapp with role based access control using Acegi (Spring) security. So i have different users with roles: ROLE_ADMIN
, ROLE_USER
and etc.
However, i need to implement various user constraints.
Let's consider an example:
Suppose, there is a site where users can watch movies online. There are users with roles
ROLE_STANDARD_USER
andROLE_VIP_USER
. Standard users can watch 3 movies a week and vip users can watch 10 movies a week plus have some other privileges. And there is one user in standard user group to whom i want to give additional 2 movies per week. The number of allowed movies may sometimes change.
Also, there are various categories of movies: fantasy, comedy, classic, new movies and etc. And i want that some users, regardless of their role, have access only to certain categories. The categories can be created and removed dynamicaly.
Are there any standard practices for implementing such type of user constraints?
Can/should it be done using Spring Security roles and permissions?
Or i need to consider adding a rule based engine to my app?
Thank you.
Edit:
The example above is fictional, my project is concerned with granting remote access to various networking (and other) equipment for students. However, the types of user constrains are likely to be the same.
Unfortunately, the Model for user access & constraints is not complete and stable. In the near future i might be told to implement various additional constraints for users, that are not known now.
So i would like to select a path now that will ease addition or change of new user constraints in future and would not require significant overhaul of internal model or database structure. If that at all possible.
Edit 2
Currently, basic user constraints are hardcoded (leftover from prototyping system). I guess i'll try refactoring it first to some kind of parametrized business services objects first and then think where can i go from there. I will also consider using Spring Security Authorization Decision Managers.
Thank you for all suggestions!