I working in WPF application with multiple screens. And now we are creating the security of Roles. The schema the we have is like the following: Every User can have multiple roles, and every Role has multiple permissions. Permission is a pair as: (Object, AccessLevel). And Access Levels are (Read, Modify, Non-Visible).
the client side gets the permissions as a dictionary< string, string> contains permissions of all user's roles:
- The first string is the object that we have to apply the access-level on it.
- The second string is the access level.
And I have a SecurityManager which is singleton, contains a dictionary < string, string> and related methods. One method returns the permission for specific object.
public String GetModuleUserSettings(string SecurableObj)
{
if (!this.ContainObjectPermission(SecurableObj))
this.mPermissions[SecurableObj] = new String();
return this.mPermissions[SecurableObj].Clone();
}
What I need is, to use this singleton in xaml,
<Control IsEnabled="{Binding Source={x:Static SecurityManager.Instance.Permissions[ControlName]}, Converter={}}"
I have some problems:
1- If I could have to apply on my own control and UIelements that Im using a method called SetSecurity(), takes the ObjectName and returns the access-level.
2- These two properties (IsEnabled, Visibility) are the target properties to apply the access-level on any control(object).But both have been binded to another properties for other reason! For example:
IsBusy="{Binding IsBusy}" Visibility="{Binding IsBusy, Converter={StaticResource booleanToVisibilityConverter}}"