Welcome Guest, Not a member yet? Register   Sign In
Application design (user object) santiy checkH
#1

[eluser]ptvw2011[/eluser]
Hello friends,

I am making a web application which has 3 account types. Each account types will have meta data associated with it. Personal information like cellphone, address etc which may or may not be viewable by others depending on the users preferences. For each role, different functions will be available.

As it stands I have a database table which has a user_id as a foreign key and various permission fields like show_cellphone or receive_notifications. I will use integers to check if they can or cant do something.

I am thinking of using session to read this table when a user logs in to figure out what they can and cant do and what should be shown.

Or should I load a helper function which performs this?

Or maybe I should wrap my classes in a class which detects all this from the beginning?

All opinions welcome.

Many thanks and I hope you have a good day.
#2

[eluser]sofwan[/eluser]
My opinion is use session in each user. There is a table contains username and privileges, such as administrator and ordinary_user.After a user login, the sesion keep the username and its privileges and in your code, you can filter what can view by a user depend on the privileges he has. For administrator, as usual, the administrator can access all of features. And for ordinary_user it's limited in access of features.




Theme © iAndrew 2016 - Forum software by © MyBB