0

I am building an application with a user login and various functions.
I want to use a flexible structure to load the current Users privileges into.
eg the Functions could be:
Product Maintenance
Customer Maintenance
Supplier Maintenance
Accts Receivable, etc

For each Function the User can be assigned privileges:
Read Access
List Access
Update
Add
Delete
Print

When the user logs in, I currently retrieving his functions and privileges from the database
and I would like to iterate each row and load them in a structure that can be used while navigating the application.

Does anyone have any thoughts on this? I first thought an array but I would need to iterate it to find the row with the name of the function.
A structure would be better but I would need to declare each function at startup before reading the database.

Any thoughts?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by GeekByChoiCe
0

Why don't you create a User Class? something like this:

public class User

public property ForeName as string
public property LastName as string
public property AssignedFunctions as List(of string)

sub New()
AssignedFunctions = new List(of string)
end sub

end class

Then on getting the DB stuff you simply do

dim newUser as new User with {.ForeName="Susi", .LastName="Sorglos"}
newUser.AssignedFunctions.add("Read")
'or if u get the assigned functions from the DB separeted by comma
newUser.AssignedFunctions.addrange(dbValue)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.