rmokkenstorm Posted March 1, 2006 Posted March 1, 2006 I'm building a Login sript zo people can acces the data base but need some tips or tutorials The user has to fill in a Username, Password, And the database he/she want's to acces.. now I Thinks I should load some session of some kind.. cause there are more then one departments.. with different rights.. whit this session or some kind of.. I let them go into the next form.. this form contains a Few buttons.. But if the user is from department A he can nog see all the buttos.. Same story for department B. should I use some kind of sessions? where do i put this sripting (a config form or in each form or the database trigger of view) hope you could me some good search advise of some tutorials Quote
rmokkenstorm Posted March 2, 2006 Author Posted March 2, 2006 Please anyone? Really need some advise :( Quote
Administrators PlausiblyDamp Posted March 2, 2006 Administrators Posted March 2, 2006 It might help if you gave some more specifics - is this a web or windows application (posting questions in the correct place helps). What version of .Net is this being developed on? Do you currently have any existing security model or are you going to be designing everything from scratch? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rmokkenstorm Posted March 2, 2006 Author Posted March 2, 2006 Visual C#.net 2003. windows forms. There is a existing database. The project is to build up the application in C#.net. Almost everything exept for some view's it should be rebuild. Quote
rmokkenstorm Posted March 3, 2006 Author Posted March 3, 2006 Someone... Please... Help me :(... Quote
Administrators PlausiblyDamp Posted March 3, 2006 Administrators Posted March 3, 2006 If you are developing a windows forms application then you will not need to be using session variables as these are a web concept anyway. As a starting point you might want to investigate the GenericIdentity and GenericPrinciple classes in the framework - these will make a good starting point for a user / group based security mechanism. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Voldron Posted March 8, 2006 Posted March 8, 2006 Create a login screen. Write a simple if statment for a login method(this will use a bool). Create some way to compare username with a username in some sort of db or file and then make sure that the password is in relation to username, then return a boolean. If it makes a match, return true, otherwise return false. boolLogin = LoginMethod( txtUsername.text, txtPassword.text); if(boolLogin == true) { //Successful login } else { //Failed Login } Something like that, it is fairly simple as you can tell. If you are doing a db thats, SELECT * FROM <dbName> WHERE username = '<username>' AND password = '<password>'. Hope this helps, John Quote
rmokkenstorm Posted March 8, 2006 Author Posted March 8, 2006 Sounds logic. But thinks this is not correct for me. If a user logon he/she should be a member of a group and this will decide which buttons the user can see. Or if the user has writting or reading rights or some table's or fields. Or am i missing some part of do i conclude to quick. :) Quote
Cags Posted March 8, 2006 Posted March 8, 2006 Sounds to be like you can use a method similar to the one that Voldron decides. If you are storing the login information in a db then you have a few choices. You could put the logins for different groups in different tables, then have the user select which group they are in when they log-on. This way the application would know which buttons to display right off the bat. Otherwise you have an extra field in the table stating the group and you would need to either set a public enum for the group in the LoginMethod method, else return a group enum (which could include an Invalid value for incorrect data). Quote Anybody looking for a graduate programmer (Midlands, England)?
Voldron Posted March 10, 2006 Posted March 10, 2006 (edited) what you could do is setup a switch statement that listens for a certain value, say groupNumber, so for instance groupNumber gets assigned a value the switch statment will be triggered and so on. So what I am suggesting is something like this. int groupNumber; switch(groupNumber) { case 1: <buttons visible for this group> break; ... default: <default buttons to be visibile for anonymous users> break; } I use this method mostly for user levels and permissions in my applications. Cheers Edited March 10, 2006 by Voldron Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.