我拥有 Spring Security Core 中的角色 student。角色学生可以编辑您的信息。但如果他想编辑另一个用户的信息,这也是可能的。
@Secured(['ROLE_ADMIN','ROLE_STUDENT'])
@PreAuthorize('isAuthenticated() and principal?.id == #studentInstance.id')
def edit(Student studentInstance) {
respond studentInstance
}
我使用了 ACL 插件,但它不起作用。您仍然可以编辑其他学生。