Hi, i'm starting a project using ASP.NET MVC and i can't figure out what's the best way of handling authorization and roles based on a team_id. Every blog entry or forum post i read always talk about defining a global role("admin", "helpdesk", "editor", etc...) using asp.net membership or creating a CustomAuthorize filter. The problem in my application is that there are no global roles. A user is going to be manager of team1, but cannot edit or view team2 details. So the authorization details are: - A user can view his team planning and his team mates availability, but cannot see other teams - team manager can edit team details, but cannot edit other team's details - A team can have 1 or many managers - A user can be part of 1 or many teams
ATM, i have 3 tables to handle this relation.
teams --> teams_users <-- users
team_id #team_id user_id
#user_id
isManager?
As last resort, i'm planing on storing user's current team_id and isManager status in session vars when he logs in, and create a CustomAuthorize filter that will check if session team_id is the same as model.team_id. Let me know if there is another way of doing it. Thank you