From 5014ad4a1a50e856504f9f6a0279b7318fde50d6 Mon Sep 17 00:00:00 2001 From: Nathan Dunn Date: Tue, 1 Apr 2014 13:51:42 -0700 Subject: [PATCH] updated edit / new functionality for sections to allow editing --- .../uoregon/nic/nemo/portal/RegisterController.groovy | 11 ++++++++++- .../edu/uoregon/nic/nemo/portal/UserTagLib.groovy | 10 +++++++--- grails-app/views/condition/show.gsp | 5 ++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/grails-app/controllers/edu/uoregon/nic/nemo/portal/RegisterController.groovy b/grails-app/controllers/edu/uoregon/nic/nemo/portal/RegisterController.groovy index 93f8d30..d8a3567 100644 --- a/grails-app/controllers/edu/uoregon/nic/nemo/portal/RegisterController.groovy +++ b/grails-app/controllers/edu/uoregon/nic/nemo/portal/RegisterController.groovy @@ -34,6 +34,8 @@ class RegisterController extends grails.plugins.springsecurity.ui.RegisterContro userLaboratory = Laboratory.findById(command.laboratoryId as Integer) } + println " laboratory id: ${command.laboratoryId} -> ${userLaboratory}" + String salt = saltSource instanceof NullSaltSource ? null : command.username SecUser user = lookupUserClass().newInstance( // email: command.email @@ -41,8 +43,15 @@ class RegisterController extends grails.plugins.springsecurity.ui.RegisterContro , accountLocked: true , enabled: true , fullName: command.fullName - , laboratory: userLaboratory ) + + + + if(userLaboratory){ + user.addToLaboratories(userLaboratory) + userLaboratory.addToUsers(user) + } + // Role role = Role.findByAuthority(Role.ROLE_VERIFIED) // SecUserRole secUserRole = new SecUserRole( // secUser: user diff --git a/grails-app/taglib/edu/uoregon/nic/nemo/portal/UserTagLib.groovy b/grails-app/taglib/edu/uoregon/nic/nemo/portal/UserTagLib.groovy index c11525a..1726ece 100644 --- a/grails-app/taglib/edu/uoregon/nic/nemo/portal/UserTagLib.groovy +++ b/grails-app/taglib/edu/uoregon/nic/nemo/portal/UserTagLib.groovy @@ -8,6 +8,7 @@ class UserTagLib { def editable = { attrs, body -> def currentUser = springSecurityService.currentUser log.debug "has a current user ${currentUser}" + log.debug "attrs: ${attrs}" if(!currentUser) return if(userService.isAdmin(currentUser)){ @@ -18,6 +19,8 @@ class UserTagLib { def users = attrs.users + log.debug "users: ${users}" + if(users instanceof SecUser){ if (currentUser == users){ out << body() @@ -28,12 +31,13 @@ class UserTagLib { def user = attrs.user ?: currentUser - log.debug "user ${currentUser}" + log.debug "A user! user ${attrs.user}" + log.debug "A user2! user ${user}" if(users){ - println "users - ${users}" + log.debug "users - ${users}" for(u in users){ - println "u ${u}" + log.debug "U ${u?.id} vs ${user.id}" if(u.id == user.id){ out << body() return diff --git a/grails-app/views/condition/show.gsp b/grails-app/views/condition/show.gsp index 3f20093..8554e0a 100644 --- a/grails-app/views/condition/show.gsp +++ b/grails-app/views/condition/show.gsp @@ -60,7 +60,6 @@ -
@@ -79,9 +78,9 @@
- + - +