G
Guest
I'm looking for some design guidance on a collection of projects I'm working
on.
The project involves a bunch of websites constructed out of a collection of
user controls. Different user populations with different access rights and
"roles" will be visiting the site. I will be using ASP.NET 2.0's membership,
roles, and profiles stuff to manage access.
User controls need to be visible or not visible depending on user role. In
some cases, one user role will see one "facet" of a control, while another
user role will see a different aspect of it.
The user controls are often going to be placed at runtime, and have their
properties adjusted at runtime.
What I am wondering now is the best way to centralize the code that manages
the display of these user controls based on role. What I don't want is
"if-else" junk spread throughout my code.
The project is large but not huge, and I am the sole developer for the
project. I have a few ideas for how this might work.
One might be to write a huge function: public static bool IsElementDisplayed
(string roleName, string userControlName) and have visibility of various
elements constantly checking this.
Another might be to use some form of inheritance. User controls can't
inherit from each other, but maybe they can inherit functionality from
somewhere else.
Another might be to encode this knowledge in some kind of structured data. A
database would be a disaster, but XML might be better.
Any suggestions and guidance out there?
Thanks,
-KF
..
on.
The project involves a bunch of websites constructed out of a collection of
user controls. Different user populations with different access rights and
"roles" will be visiting the site. I will be using ASP.NET 2.0's membership,
roles, and profiles stuff to manage access.
User controls need to be visible or not visible depending on user role. In
some cases, one user role will see one "facet" of a control, while another
user role will see a different aspect of it.
The user controls are often going to be placed at runtime, and have their
properties adjusted at runtime.
What I am wondering now is the best way to centralize the code that manages
the display of these user controls based on role. What I don't want is
"if-else" junk spread throughout my code.
The project is large but not huge, and I am the sole developer for the
project. I have a few ideas for how this might work.
One might be to write a huge function: public static bool IsElementDisplayed
(string roleName, string userControlName) and have visibility of various
elements constantly checking this.
Another might be to use some form of inheritance. User controls can't
inherit from each other, but maybe they can inherit functionality from
somewhere else.
Another might be to encode this knowledge in some kind of structured data. A
database would be a disaster, but XML might be better.
Any suggestions and guidance out there?
Thanks,
-KF
..