Changeset 1724
- Timestamp:
- Apr 7, 2011, 2:50:12 PM (12 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/AssayController.groovy
r1716 r1724 123 123 action{ 124 124 def user = authenticationService.getLoggedInUser() 125 flow.userStudies = Study. findAllByOwner(user)125 flow.userStudies = Study.giveReadableStudies(user) 126 126 } 127 127 on("success").to "selectAssay" -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r1659 r1724 449 449 * Returns a list of studies that are writable for the given user 450 450 */ 451 public static giveWritableStudies(SecUser user, int max ) {451 public static giveWritableStudies(SecUser user, int max = null) { 452 452 // User that are not logged in, are not allowed to write to a study 453 453 if (user == null) … … 459 459 if (user.hasAdminRights()) { 460 460 return c.listDistinct { 461 maxResults(max)461 if (max != null) maxResults(max) 462 462 order("title", "asc") 463 463 … … 466 466 467 467 return c.listDistinct { 468 maxResults(max)468 if (max != null) maxResults(max) 469 469 order("title", "asc") 470 470 or { … … 480 480 * Returns a list of studies that are readable by the given user 481 481 */ 482 public static giveReadableStudies(SecUser user, int max , int offset = 0) {482 public static giveReadableStudies(SecUser user, int max = null, int offset = 0) { 483 483 def c = Study.createCriteria() 484 484 … … 486 486 if (user == null) { 487 487 return c.listDistinct { 488 maxResults(max)488 if (max != null) maxResults(max) 489 489 firstResult(offset) 490 490 order("title", "asc") … … 496 496 } else if (user.hasAdminRights()) { 497 497 return c.listDistinct { 498 maxResults(max)498 if (max != null) maxResults(max) 499 499 firstResult(offset) 500 500 order("title", "asc") … … 502 502 } else { 503 503 return c.listDistinct { 504 maxResults(max)504 if (max != null) maxResults(max) 505 505 firstResult(offset) 506 506 order("title", "asc")
Note: See TracChangeset
for help on using the changeset viewer.