From 29d8c9f801a08df98618ae7a52446f1e4ab8685b Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Wed, 24 Apr 2013 15:43:54 -0700 Subject: [PATCH] Fix too-long value for api token roles #327 don't store unused auth roles in token change auth roles to text column for future use --- .../controllers/rundeck/controllers/UserController.groovy | 3 +-- rundeckapp/grails-app/domain/rundeck/AuthToken.groovy | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rundeckapp/grails-app/controllers/rundeck/controllers/UserController.groovy b/rundeckapp/grails-app/controllers/rundeck/controllers/UserController.groovy index 9b2b772bace..295c5c5206d 100644 --- a/rundeckapp/grails-app/controllers/rundeck/controllers/UserController.groovy +++ b/rundeckapp/grails-app/controllers/rundeck/controllers/UserController.groovy @@ -184,8 +184,7 @@ class UserController { while(AuthToken.findByToken(newtoken) != null){ newtoken = genRandomString() } - final userroles = request.subject?.getPrincipals(com.dtolabs.rundeck.core.authentication.Group.class).collect { it.name } - AuthToken token = new AuthToken(token:newtoken,authRoles: userroles.join(","),user:u) + AuthToken token = new AuthToken(token:newtoken, authRoles: 'api_token_group',user:u) if(token.save()){ log.debug("GENERATE TOKEN ${newtoken} for User ${login} with roles: ${token.authRoles}") diff --git a/rundeckapp/grails-app/domain/rundeck/AuthToken.groovy b/rundeckapp/grails-app/domain/rundeck/AuthToken.groovy index 70c1dcb2bc4..4ee408ae5a4 100644 --- a/rundeckapp/grails-app/domain/rundeck/AuthToken.groovy +++ b/rundeckapp/grails-app/domain/rundeck/AuthToken.groovy @@ -25,4 +25,7 @@ class AuthToken { authRoles(nullable:false) user(nullable:false) } + static mapping = { + authRoles type: 'text' + } }