BACKGROUND:
I am creating a WPF application (.NET 4.5 with MVVM-Light)
I have created user roles in the database that backs the WPF application where the users of the WPF App have an assigned role (i.e. user, manager, owner, admin)
WHAT I WANT:
My client wants to be able to restrict what the users see and what the users can do based on their role. There are some views that will be seen by all users, therfore some visual elements (grids, buttons etc..) should be hidden or disabled depending on the users role.
WHAT I HAVE:
I have created an IUserService that gets injected into every viewmodel. The roles that I have created have a field that marks their security level(simply an integer 1 through 5). I want to be able to restrict the visiblity of visual elements based on this number.
For example, My plan is to bind the visibility of the element to a boolean property (using a boolToVisibility Converter) in the viewmodel (Level1, Level2, etc) and that property would return true if the users level matches or is greater than the property level.
MY CONCERNS:
My concern is that this is a lot of work to implement in every viewmodel and on every visual element that is needed. Also, I already have some visual elements that are affected by other business logic.
QUESTION:
What is an efficient way to restrict users ability to "view" visual elements based on a user role strategy?
I am prepared to start this work, But I would love to hear some other ideas from the community on how user role based security is implemented in a WPF application.