管理员帐户应该与客户处于同一用户类别吗?
我学习 Grails 和 Spring Security 插件。
我不知道如何设计具有两层的示例 Web 应用程序:客户可以查看产品和类别并订购产品(如果他/她已注册并登录),管理员可以登录到管理面板,他/她可以管理类别和产品 (CRUD)。我的问题是:所有用户(管理员和客户)都应该属于一个用户类别吗?我认为所有应用程序(目录和管理面板)都应该由 Spring Security 插件保护。
I learn Grails and Spring Security plugin.
I don't know how to design sample web application with two layers: customer can view product and categories and order a product (if he/she is registered and logged in) and admin who can logged in to admin panel where he/she can manage categories and products (CRUD). My question is: should all users (admin and customer) be in one User class? I suppose that all apllication (catalog and admin panel) should be secured by Spring Security plugin.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 Spring Security 插件,则默认行为假定所有用户都是同一类的实例。您可以通过检查用户类的
roles
属性返回的内容来区分管理员和客户。该插件提供了一项服务和各种 Grails 标签,您可以使用它们来确定用户是否是管理员、客户、是否经过身份验证等。
If you're using the Spring Security plugin then the default behavior assumes all users are instances of the same class. You can distinguish between an administrator and a customer by checking what's returned by the
roles
property of the user class.The plugin provides a service and various Grails tags that you can use to figure out whether a user is an administrator, a cusomer, is authenticated, etc.
是的,所有用户都应该属于一类。然后为每个用户分配角色。例如,一个用户可以拥有 ROLE_USER,另一个用户可以拥有 ROLE_USER、ROLE_ADMIN
yes all users should be one class. and then you assign roles to each user. for example a user can have the ROLE_USER, and another user can have the ROLE_USER,ROLE_ADMIN