From faeacd97965df4100cf09833fd22630f3d5a5f22 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Mon, 9 Oct 2023 09:12:07 +0530 Subject: [PATCH] Update S2QuickstartCommand.groovy (#942) Fixes #905 --- .../S2QuickstartCommand.groovy | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/plugin/grails-app/commands/grails.plugin.springsecurity/S2QuickstartCommand.groovy b/plugin/grails-app/commands/grails.plugin.springsecurity/S2QuickstartCommand.groovy index ed331615..351fe961 100644 --- a/plugin/grails-app/commands/grails.plugin.springsecurity/S2QuickstartCommand.groovy +++ b/plugin/grails-app/commands/grails.plugin.springsecurity/S2QuickstartCommand.groovy @@ -188,36 +188,25 @@ Example: ./gradlew runCommand "-Pargs=s2-quickstart --uiOnly" final Properties props = new Properties() file("gradle.properties")?.withInputStream { props.load(it) } - - boolean gormVersionAfterThreshold = versionAfterOrEqualsToThreshold(GORM_VERSION_THRESHOLD, - (String) props.gormVersion ?: (String) props.getProperty("gorm.version")) - - if (gormVersionAfterThreshold) { - generateFile('PersonWithoutInjection', userModel.packagePath, userModel.simpleName) - if (salt) { - generateFile('PersonPasswordEncoderListenerWithSalt', - userModel.packagePath, - userModel.simpleName, - "${userModel.simpleName}PasswordEncoderListener", 'src/main/groovy') - } else { - generateFile('PersonPasswordEncoderListener', - userModel.packagePath, - userModel.simpleName, - "${userModel.simpleName}PasswordEncoderListener", - 'src/main/groovy') - } - List> beans = [] - beans.add([import : "import ${userModel.packageName}.${userModel.simpleName}PasswordEncoderListener".toString(), - definition: "${userModel.propertyName}PasswordEncoderListener(${userModel.simpleName}PasswordEncoderListener)".toString()]) - addBeans(beans, 'grails-app/conf/spring/resources.groovy') - + + generateFile('PersonWithoutInjection', userModel.packagePath, userModel.simpleName) + if (salt) { + generateFile('PersonPasswordEncoderListenerWithSalt', + userModel.packagePath, + userModel.simpleName, + "${userModel.simpleName}PasswordEncoderListener", 'src/main/groovy') } else { - if (salt) { - generateFile('PersonWithSalt', userModel.packagePath, userModel.simpleName) - } else { - generateFile('Person', userModel.packagePath, userModel.simpleName) - } + generateFile('PersonPasswordEncoderListener', + userModel.packagePath, + userModel.simpleName, + "${userModel.simpleName}PasswordEncoderListener", + 'src/main/groovy') } + List> beans = [] + beans.add([import : "import ${userModel.packageName}.${userModel.simpleName}PasswordEncoderListener".toString(), + definition: "${userModel.propertyName}PasswordEncoderListener(${userModel.simpleName}PasswordEncoderListener)".toString()]) + addBeans(beans, 'grails-app/conf/spring/resources.groovy') + generateFile('Authority', roleModel.packagePath, roleModel.simpleName) generateFile('PersonAuthority', roleModel.packagePath, userModel.simpleName + roleModel.simpleName)