的Grails:3.3.0 春季安全:3.2.0.M1grails 3;使用Spring Security看到自己的数据
我已经做了这方面的一些研究,我发现,从(Seeing only your own data in Grails)的职位,答案可能是答案我正在寻找,但不知何故,它不起作用。
这就是我如何捕获登录用户并尝试过滤掉并让登录用户查看自己的数据。 (这是我的任务控制器) 通过什么用的[任务:任务]的方式
def index(Integer max) {
def authenticated = getAuthenticatedUser().username
def tasks = User.findAllByUsername(authenticated)
[tasks: tasks]
params.max = Math.min(max ?: 10, 100)
respond Task.list(params), model:[tasks: Task.count()]
}
这是我的任务域
class Task {
transient springSecurityService
String task
Project project
Pic picName
static hasMany = [subTask:Subtask]
static belongsTo =[Project,Pic,User]
}
请给我一些建议或请让我知道我在哪里 犯错! 在此先感谢! 最好的问候,熙
感谢您的答复!其实我的问题只是我没有在我的GSP上提出。 非常感谢您的建议 – Trainee