Link to home
Start Free TrialLog in
Avatar of SlammingRumJoseph
SlammingRumJoseph

asked on

Creating a global Application Permission class

Hi

I have been taxed by a problem that my brain refuses to process.

I am developing an Windows Forms application that consists of a number of forms, each allowing users to carry out specific tasks. I want to be able to restrict certain users to certain tasks ie Administrator - Can do everything, Secretary - Can only view, not delete etc.

I have a database structure which details what a certain type of user can do which tasks. I want to able to load these details into a class when the application loads and use properties of the class to enforce the restrictions throughout the application.

However, i cant seem to figure out the best approach to this. Can I use a global class in vb.net that is visible to all the forms? If so, how do you set a global variable in vb.net (that is visible across multiple forms).

Any better ways of doing this? I would be grateful for any useful links that can help me out with this dilemma.

Thanks.

Avatar of oleggold
oleggold
Flag of United States of America image

Yes,YOU need to create a DLL and put it into GAC
ASKER CERTIFIED SOLUTION
Avatar of Olaf_Rabbachin
Olaf_Rabbachin
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RJeyaPrakash
RJeyaPrakash

are you referrring database operations for users? if so, is it varying on each form or it is globally unique across. And users means system users or your application users????
what I did what I have a all the user permissions searchs done in my globals.

ex

public sub main()

connect to the database
query rights for a certain user
ex: select * from permissions where employee = '" & employee & "'"
then assign variable to the rights

end sub

so pretty much the user logs in then there login name is also in the database that has what they are allowed to do in it. so I take that name and query that. Then whatever they are allowed to do is pulled into variables and used throughout the program
put variables in the globals as public variablename as string, integer, etc

Avatar of SlammingRumJoseph

ASKER

thanks for your help. I ended up using a <shared> class. I just need to ensure that I was doing this is in a good way.
Alright - let's see it then!
At least the very basic stuff, that is, depending on just how many lines your class actually contains. :-)

Cheers,
Olaf
"I cant give you tab unless you order something."
Ahem - ?
Not being native to the English language I might just no have understood what you mean ..? :-)

I just interpreted your previous statement as in "OK, I got it now but am still uncertain whether it's actually OK". So, if you'd like us to check, we'll need the code.

Cheers,
Olaf