Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,709 members, 7,809,691 topics. Date: Friday, 26 April 2024 at 01:18 PM

Multiple Login Control - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Multiple Login Control (2553 Views)

Login Code In Vb6.0 / I Need A Help To Write A Simple Login Form Using Vb.net / [Code Request] Code for PHP Login And Signup (2) (3) (4)

(1) (Reply) (Go Down)

Multiple Login Control by ABAboi: 11:28pm On Nov 22, 2009
Hello guys, am working on a staff management program(using VB.NET and SQLSERVER) that requires workers with different authorities to access the system. For Instance, a gardener and Manager will log in to the system using a unique staff ID. What is your idea on how to differentiate between the users when they log in??

Re: Multiple Login Control by Parohfrey(f): 11:36pm On Nov 22, 2009
is the staffid not unique to each person, what else do you want to use to differentiate?
Re: Multiple Login Control by Beaf: 1:10am On Nov 23, 2009
Use ASP.Net Membership, it contains all the classes you need for a role based authentication system. It is a synch to use, why re-invent the wheel?
Google ASP.Net Membership.

For windows forms http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm
Re: Multiple Login Control by ABAboi: 12:37pm On Nov 23, 2009
Paroh_frey:

is the staffid not unique to each person, what else do you want to use to differentiate?


I am able to authenticate all the staff ID thats not the issue. For instance, i need to show form1 if the gardener is logged in, form2 if manager is logged etc.

Beaf:

Use ASP.Net Membership, it contains all the classes you need for a role based authentication system. It is a synch to use, why re-invent the wheel?
Google ASP.Net Membership.

For windows forms http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm

The code was quite helpful thanks. But i am using VB not ASP as the program is not web based.
Re: Multiple Login Control by Nobody: 1:31pm On Nov 23, 2009
ABAboi:

I am able to authenticate all the staff ID thats not the issue. For instance, i need to show form1 if the gardener is logged in, form2 if manager is logged etc.

The code was quite helpful thanks. But i am using VB not ASP as the program is not web based.


u can either create the 2 forms, do some checks based on a preset privilege, then display the right form
or show/hide widgets if the differences in both forms are not much


but really, if u have issues with managing previleges, only God knows,
Re: Multiple Login Control by ABAboi: 2:03pm On Nov 23, 2009
webdezzi:

u can either create the 2 forms, do some checks based on a preset privilege, then display the right form
or show/hide widgets if the differences in both forms are not much


but really, if u have issues with managing previleges, only God knows,
Thanks for your input. Those checks based on a preset privilege is what i want to know. I thought about creating a column called Authority in the table, then assigning them with number eg gardener =1, Manager = 2, But i need other ideas on how to make it work better
Re: Multiple Login Control by Beaf: 3:19pm On Nov 23, 2009
ABAboi:

I am able to authenticate all the staff ID thats not the issue. For instance, i need to show form1 if the gardener is logged in, form2 if manager is logged etc.

The code was quite helpful thanks. But i am using VB not ASP as the program is not web based.

Hmm. That page is a not for web based apps, it for windows forms with code in VB.NET.

Anyways (since you can already authenticate), the simplest way is to use two panels in the same form. Then you can hide one of the panels depending on who is logged on. Set the Visible property based on if Authority = 1 or Authority  = 2.
Its much like webdezzi has said.
Re: Multiple Login Control by Nobody: 4:43pm On Nov 23, 2009
u can create a table e.g acesslvl, with 2 columns, id and privname
the id column can be autoincremented with privname holding varchars like manager gardener etc.

so u take note of which has which id
say manager was added first and with id 1
u just need to hard code the id

if id==1:
#code to handle manager gui
elif id==2:
#code to handle gardener gui

with this, you can even display the rank of the logged in user to him.
that's cool
Re: Multiple Login Control by yawatide(f): 5:17pm On Nov 23, 2009
webdezzi:
I could be wrong but I think your table will need a 3rd column - a reference, as a secondary key, to the user table so that the system knows which level each user is.

The way you have it now, the levels are but to whom are they assigned?

Again, I could be wrong but I think that is what you will need for your table wink
Re: Multiple Login Control by ABAboi: 9:18pm On Nov 23, 2009
Thanks guys for your inputs. I managed to do it. I used to a while loop to read the column(Access Level which happens to be the third column) while authenticating the user. The sample code below was wat i did. Once again thanks

If theReader.HasRows Then 'we have data, user exists


success = True
End If
While theReader.Read
authorityReader = theReader(2)
End While
Re: Multiple Login Control by Nobody: 8:01am On Nov 24, 2009
while there are many approaches to a task,
my view is this.
since he will be coding different interfaces for different ranks in the organization
and every additional interface will require revisiting the source code. it is not bad if he uses the values of the id column directly in his source code.

now he has to add an extra column to the user's table e.g usr_access, on this column mr joe who is the manager gets 1, which is the first added rank to the accesslvl table and matches with the manager ranking.

then his code will only need to check this usr_access column to see if it is 1 or 2 and display the correct gui
the essence of the accesslvl table becomes to show off what rank or position you occupy in the company


Thanks guys for your inputs. I managed to do it. I used to a while loop to read the column(Access Level which happens to be the third column) while authenticating the user. The sample code below was wat i did. Once again thanks

If theReader.HasRows Then 'we have data, user exists


            success = True
        End If
        While theReader.Read
            authorityReader = theReader[b](2)[/b]
        End While

I guess that's VB's way of accessing the 3rd column?
and I may be wrong, I think using "while" means that you expect to get many rows then execute each row as they come, I may be wrong.
Re: Multiple Login Control by dotzok: 11:36pm On Nov 25, 2009
The approach uv adopted isnt bad actually, but as your program widens u fault and drop some ideas.

I would go with Beaf's Membership idea, for now!

But later, u'd see the necessity of making the wheels again. You may need to add ur menu name, form names,role id and etc into a table say usr_access in ur DB and completely manage the distribution of priviledges urself.

This implies that you're going to create a form to: create Users, assign roles to them (from a set of created roles).

You'll kip at least 2 tables to get this done. A table would kip all ur menu items and their ids, the other would keep role_id and menu_id,

The moment a user logs in with his/her [id], use querry to fetch his priviledges i.e. menu items from the [roles] table, then use some vb syntax to display just those items and he sees only those menu items.

I wouldnt know if VB.Net uses Session() as does ASP;it would have helped on one side.

Regards.
Re: Multiple Login Control by ABAboi: 12:32pm On Nov 26, 2009
dotzok:

The approach uv adopted isnt bad actually, but as your program widens u fault and drop some ideas.

I would go with Beaf's Membership idea, for now!

But later, u'd see the necessity of making the wheels again. You may need to add your menu name, form names,role id and etc into a table say usr_access in your DB and completely manage the distribution of priviledges urself.

This implies that you're going to create a form to: create Users, assign roles to them (from a set of created roles).

You'll kip at least 2 tables to get this done. A table would kip all your menu items and their ids, the other would keep role_id and menu_id,

The moment a user logs in with his/her [id], use querry to fetch his priviledges i.e. menu items from the [roles] table, then use some vb syntax to display just those items and he sees only those menu items.

I wouldnt know if VB.Net uses Session() as does ASP;it would have helped on one side.

Regards.

Thanks dotzok, the idea is that simplicity is required in the login page(thats the functional requirement of the system) so i am trying to build the system based on the required specifiation. To create staff and their roles, the administrator will be able to create, assign roles and generate a temporary passwords which the users will change when they successfully login to the system. As per the sessions() available in ASP, i will check if there is any in VB
Re: Multiple Login Control by transformR: 9:17pm On Nov 26, 2009
ABAboi:

Thanks guys for your inputs. I managed to do it. I used to a while loop to read the column(Access Level which happens to be the third column) while authenticating the user. The sample code below was wat i did. Once again thanks

If theReader.HasRows Then 'we have data, user exists


            success = True
        End If
        While theReader.Read
            authorityReader = theReader(2)
        End While

You're approach is quite risky Beaf gave you the correct advice:

Beaf:

Use ASP.Net Membership, it contains all the classes you need for a role based authentication system. It is a synch to use, why re-invent the wheel?
Google ASP.Net Membership.

For windows forms http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm

When you use this approach a database called ASPNETDB.MDF will be generated with all of the security features you need and users will be filtered based on their roles - it will save you alot of time!

(1) (Reply)

What Is The Longest Line Of Code You Have Written And In What Language / I Need Pdf E-book On Vb.net For Web Application / Php Vs Asp: Which One Is Better?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 33
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.