Security levels in windows application

  • Thread starter Thread starter grawsha2000
  • Start date Start date
G

grawsha2000

Greetings,

I'm developing this windows application (typical MIS, N-tier business
app) in vb.net 2005, and I'm wondering about a good method where I can
enable/disable buttons and menus based on user levels.

Users in Managers group are allowed to have r/w permissions, operators
only read permissions..etc.

I thought of using block of codes where one block would disable/enable
the whole set of buttons if user in manager group, another block would
the same thing BUT for operation group..etc.

CODE

dim strUserGroup as string

IF strUserGroup ="Mangers" then

cmdAdd.enable=true
cmdUpdate.enable=true
cmdQuery.enable=true
..
..
..
IF strUserGroup ="Operator" then

cmdAdd.enable=false
cmdUpdate.enable=false
cmdQuery.enable=true
..
..
..

Any Idea/s about a better way of doing this?

MTIA,
Grawsha
 
Greetings,

I'm developing this windows application (typical MIS, N-tier business
app) in vb.net 2005, and I'm wondering about a good method where I can
enable/disable buttons and menus based on user levels.

Users in Managers group are allowed to have r/w permissions, operators
only read permissions..etc.

I thought of using block of codes where one block would disable/enable
the whole set of buttons if user in manager group, another block would
the same thing BUT for operation group..etc.

CODE

dim strUserGroup as string

IF strUserGroup ="Mangers" then

cmdAdd.enable=true
cmdUpdate.enable=true
cmdQuery.enable=true
.
.
.
IF strUserGroup ="Operator" then

cmdAdd.enable=false
cmdUpdate.enable=false
cmdQuery.enable=true
.
.
.

Any Idea/s about a better way of doing this?


IF strUserGroup ="Mangers" then
EnableButtons(true)
eles
EnableButtons(false)
endif

Public sub EnableButtons(byval bset as Boolean)

cmdAdd.enable=bset
cmdUpdate.enable=bset
cmdQuery.enable=bset

if bset = false then
cmdQuery.enable=true
endif

end sub
 
(e-mail address removed) wrote in @h2g2000hsg.googlegroups.com:
Greetings,

I'm developing this windows application (typical MIS, N-tier business
app) in vb.net 2005, and I'm wondering about a good method where I can
enable/disable buttons and menus based on user levels.

Create a custom principal object and use that object to check for security.
..
 
Back
Top