Different user restrictions in same session

后端 未结 2 2105
深忆病人
深忆病人 2021-01-22 06:59

We\'re developing a website and we\'ve encountered this issue: for this website there are 2 types of users: the customer and an administrator. The administrator can see all prod

2条回答
  •  执念已碎
    2021-01-22 07:26

    I'm rather new to web development myself, but couldn't you have a field in a MySQL table called 'type', with a user either being a 'customer' or 'admin'? When someone logs in, the system could check their user type and if it's 'customer', the system could show the customer's view and if it's 'admin', the admin's view.

    You could then also have another field in a table which only applies to 'admin' type users which basically says whether the admin is viewing in admin mode or customer mode. A button on every page in 'admin' view could toggle between 'admin' and 'customer' for this new field, and that can decide what view is shown.

    Is that the kind of thing you're looking for?

提交回复
热议问题