Grails : Select all projects where the current user is a member.
Select all projects where the current user is a member.
A project has a set of members where each member is comprised of user and role.
Copy this code and paste it in your HTML
if ( ! params.
order ) params.
order = "desc" if ( ! params.
offset ) params.
offset = 0
def query
= "from Project p where exists ( from Member m where p.id = m.project.id and m.user.login='" + user.
login + "') order by p." + params.
sort + " " + params.
order + "" ;
def projectList
= Project.
findAll ( query,
[ max :params.
max ? .
toInteger ( ) , offset:params.
offset ? .
toInteger ( ) ] )
[ projectInstanceList: projectList, projectInstanceTotal: projectTotalCount]
Report this snippet