Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am developing windows application.Here i facing the problem is each user have role.each role have different menu display depend on the role,please help me
Posted
Updated 29-Jan-12 20:06pm
v2
Comments
Sergey Alexandrovich Kryukov 30-Jan-12 1:10am    
Not a question. If you need, defines some roles.
--SA
Dean Oliver 30-Jan-12 1:24am    
Question is too vague. more information is needed please.
Ben Paxton 30-Jan-12 2:19am    
Improve u question and dont beg like that

Even though this is not a question and a poorly, very poorly formulated problem, I want to just give you one idea.

Probably most people do a big mistake in design of the roles. They try to picture the roles such as "administrator", "developer", "engineer", "end user", "operator" and try to associate some access and functionality with them.

This is a wrong approach in principle. Different organizations and even different professionals can have different views on the roles, just because they picture the organization of works in different ways. Maybe, you should not even care about those roles and leave them to customer. How?

The design should start with your application. You should classify the work with your applications into several activities from the user point of view. Some can be allowed, some are not. You should classify them the way each activity would make full sense even if other activities are not allowed.

Make some administrative application which enable your customer to introduce their own roles and associate each role with one or more activities available to this role. Exactly in this way: a many-to-many relationship. On top of it, introduce the list of users, and associate a user with one role (many roles are optional because the roles themselves are flexible enough).

Leave it to the customers; let them "invent" any thinkable roles and their name. It will give them more of that Sense of Own Importance (SOI :-)) ans will save you from unwanted headache.

[EDIT]

Please see the answer by thatraja. In my comment, I've clarified my conception based on his example. Please see.

—SA
 
Share this answer
 
v2
Comments
thatraja 1-Feb-12 9:02am    
Agree, 5!
Sergey Alexandrovich Kryukov 1-Feb-12 12:02pm    
Thank you, Raja.
--SA
You need to filter the datasource based on user rights.

Consider the below options...

Options
Add Data
Edit Data
View Data
Delete Data
Print Data



User Type
Admin User
Normal User


If the user is Admin User then allow all options. If the user Normal User then restrict some options(Like Delete, Print) so filter the datasource.


Options (For Normal User)
Add Data
Edit Data
View Data


For your information

How To Create Database Driven Menu in ASP.NET (C#)[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 1-Feb-12 5:56am    
My 5.

This is a good illustration to my conception.
Please see my answer:

Consider the first table is a bitset. You allow the user create any thinkable role which is just a bitwise OR of any subset of the first table. First table is defined by your application, but the set of the roles -- by the organization of the customer. So, define this table and implement the mechanism, let the customer define the rest according to their organization and views.

How about that?
--SA
Briefly, you will need to store roles for each user in the database and based on the login id fetch them.
Once the roles are loaded, you will enable disable parts of your UI based on these roles.
 
Share this answer
 
Well the whey I did this before is at my login it checked the users user role.
Then where u open ur main form: frmMain Main = new frmMain(strUserRole) put the string of user role in these brackets,

then where ur main form in InitializeComp declare string User Role and in that space I used if else statements. eg, if(strUserRole == Admin)
{
lblWhatever.Disabled = true
etc.......
}

Thats the best I can explain this and this is working perfectly fine with my system
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900