Quote:
Rene,
You could use attributes, but you need some sort of pattern.
Basically, this is what code access security does, as you specify a role
that the current user has to be in to access the method/property, etc,
etc.
What you could do is create an attribute of your own, and specify what
roles should be able to access which parts of the user interface. Then,
you can cycle through all the controls when the form is popped up,
checking the role of the current user vs the attribute, and delete the
control or set the visibility to false.
And I'd highly recommend accessing the attributes only once, and creating a
collection of the controls for each user level, and using that collection
each time the user changes. Reflection is slow.
the question is if i should use attributes. i also thought about using
the TAG field in each control. wouldn't that be quicker then
reflection?
there is also a problem with adding controls to a collection. there is
already a list with buttons for each userlevel (should be changeable).
thought about cycling through the list at startup - setting the TAG
fields and if the user logs on - again cycling through the controls
and set's them invisible.
so my question in detail: are attributes the common way to implement
userlevels? and: is there a common way?
thank's again