Different user restrictions in same session

后端 未结 2 2065
深忆病人
深忆病人 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:22

    @Krt_Malta: If you are using Spring Security, then you don't need to have the administrator to log out and then log back in as a user. To accomplish that, you will need to configure SwitchUserFilter... it allows the user to switch from one role to another without the need to log out, which is what you want.

    0 讨论(0)
  • 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?

    0 讨论(0)
提交回复
热议问题