c# - SQL Server CE application with user permissions -


i'm trying develop application allows managing of users via winforms , sql server ce database. i've established way users login via login set in table database username , password columns.

now, i'm trying figure out best way go limit access specific features of application. goal sort application modules (customers, employees, billing, etc.) , give user read write permissions entire module. later on might try implement security on per-form basis.

any ideas on how accomplish this?

first need create roles table on sql ce.

so usertable might have roleid fk added in each user.

let have admin , user role.

in each of form, add security handler methods / class checks role of user access application.

create public string role; , puclic string username in each of form can pass values rest of form.

example on customer form load can add

if(role=="admin") {     //visible controls stuff } else {     //user     //set controls read stuff } 

on login form logon/ok click event

you can do

//your stuff on getting role of user  //validation stuff string role =  // user role;   if (role!=null) {     //if have mdi parent     var mdi = new mdiparent     {         username = txtusername.text,         role = role,     };     mdi.show();         this.hide(); } else {     //error user not valid!! } 

best regards


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -