如何限制 Grails Shiro Security 中的操作
请指导我,我的控制器中有两种方法,一种是登录,第二种是注销。在我的数据库中定义了 1 个角色“用户”,我有一个具有该角色的用户。现在我想做的是该人可以登录但无法访问注销按钮。我如何添加允许该用户不注销的权限/限制。
.please guide me that i have 2 methods in my Controller one is login and second is logout. and 1 role 'user' defined in my DB and i have a user with that role. now what i want to do is that person can login but could not access the logout button. how can i add permission/restrictions that would allow that user not to Logout.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看你的其他问题(http://stackoverflow.com/questions/5815401/how-to-implement-shiro-security-of-grails-in-my-project)并使用
roleUser.addToPermissions(' auth:login,signIn')
作为权限。这会添加您问题中所述的权限:仅允许登录,注销不在列表中,因此不允许。我们不仅要声明将显示登录屏幕的login
,还要声明signIn
这是实际登录的操作。Take a look at your other question (http://stackoverflow.com/questions/5815401/how-to-implement-shiro-security-of-grails-in-my-project) and use
roleUser.addToPermissions('auth:login,signIn')
as permission. This adds the permissions as described in your question: only login is allowed, logout is not in the list and thus not allowed. We have to state not onlylogin
which will show the login screen, but alsosignIn
which is the action of the actual sign in.