المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : User Level restriction------- which method is best xml or dll ??



C# Programming
05-05-2009, 10:52 AM
Hi all!

I have gotta small dilemma in proceeding with my project. I thought it would be better to ask the gurus to sort it out in their own fashion...

Here it goes...
I am developing a small consoleapplication, which is used to fetch data from a distance server.

The details of "which" data to be fetched is given as a command line option. I have several such commands and everything was working fine. But now, for some reasons i want to restrict the usage of certain commands, i.e., much similar like a basic user and admin user level. Admin user can use all the command options whereas basic user can use only non-restricted commands.

For this, I have created two attributes named "admin" and "basic" and applied to the corresponding commands. The attributes need to compared with the user level configuration.

Now how do i make the application to differentiate the user rights??

option 1: Have a XML config file with a "user level" field and read the XML file in the runtime and allow access...

option 2: have a shared dll file with a "user level" property and read the dll during runtime and allow access accordingly....

Note: The main requirement is that user rights can be upgraded and downgraded from "basic" to "admin" and vice versa just by modifying the configuration entries...

Please suggest, which one to use and if any other better option too....

Have a Happy Coding.....