Skip to content

Overriding NimblePluginResources.groovy #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 107 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
8e1ffde
Updated to grails 1.2.1
Feb 12, 2010
afe526e
Fixed issue GH-13 - new user on login window doesn't work
Feb 18, 2010
7f4191a
Changes to registration process:
Feb 18, 2010
88ebe6d
Added authentication callback for host application specific action on…
Feb 18, 2010
38e0e0a
Better solution to the page margin issue. Previous would show horizo…
Feb 18, 2010
f388c10
Revised authentication callback for login/logout events
Feb 19, 2010
207f255
Logout event NPE
Feb 20, 2010
287e210
Updating the sass for body padding.
Mar 15, 2010
024b00e
Merge commit 'beddoes/master'
Mar 15, 2010
be14ac1
Merge branch 'master' of git://github.com/bradleybeddoes/nimble
Mar 16, 2010
f40c075
Fixed typo causing gsp parsing bug
Mar 16, 2010
3367f09
Closes GH-19 - there were missing table names for nimble social.
Mar 16, 2010
91c0eeb
Fixed tabs v spaces in last commit.
Mar 16, 2010
cc525f5
do not output FaceBook css/js if it is not needed
Mar 19, 2010
dad50bb
preliminary work to move all javascript to /web-app/js/jquery folder
Mar 19, 2010
61bbcfa
successfully have working mootools growl.
Mar 20, 2010
040c219
added grails javascript providers from their plug-ins to nimble.
Mar 20, 2010
6f05e20
Proposed changes for allowing custom User/Profile fields to be editable.
Mar 22, 2010
7d5a7bc
Addition of events: beforeregister and afterregister.
Mar 23, 2010
443b7fd
Merging with bradleybeddoes/master
Mar 29, 2010
90b142e
Merging with bradleybeddoes/master
Mar 29, 2010
cb1563b
Closes GH-19 - Table name issues and nimble social. Implemented comm…
Mar 29, 2010
9a74724
Show validation errors for profile object (includes email, etc)
Mar 29, 2010
ddba30c
Upgrading to grails 1.2.2 and adding unique version identifier for fl…
Mar 29, 2010
a6bcc02
Merging with changes from master
Mar 29, 2010
16d68c4
Allowing register form to accept values from URL
Mar 29, 2010
d7cda7b
Bypassing account registration email if provision.enable is true
Mar 29, 2010
72d8700
Merge branch 'master' of git://github.com/bradleybeddoes/nimble
Mar 31, 2010
ba7e12a
make loginsetup JavaScript library dependent
Mar 31, 2010
50ff026
move JavaScript from login template into the loginsetup template
Mar 31, 2010
b60c4dd
make inline JavaScript library dependent
Mar 31, 2010
5853ede
revert jquery.pstrength.js back to its orginal name of jquery/jquery.…
Mar 31, 2010
958bbec
completed mootools password strength
Mar 31, 2010
bbd9a7c
make verifyUnique more JavaScript library independent
Mar 31, 2010
429e326
major patch to add mootools tips/tabs/dialogs/general functionality
Mar 31, 2010
636f6df
missing reference to new mootools tabs/dialogs
Mar 31, 2010
30fe816
finished session terminated dialog for xhr failures for mootools/nimb…
Mar 31, 2010
afbadb4
mootools tip css cleanup
Mar 31, 2010
40909c9
fixed create user still referencing now deleted templates
Mar 31, 2010
7553225
small fixes to create user.
Apr 1, 2010
4c9e6ea
fixes FaceBook login, where FaceBook connect button does not show int…
Apr 1, 2010
7ef40de
fixes problem with createTip function
Apr 1, 2010
75c3ae3
traps weird exception only only on the password policy
Apr 1, 2010
87850c5
bug fix - fixes missing field configuration when updating admins
Apr 2, 2010
084b764
renamed Portuguese to follow previously established naming convention
Apr 2, 2010
b0e6a9e
bug fix for mootools failed to list administrators on index page.
Apr 2, 2010
89f8244
bug fixes - mootools
Apr 2, 2010
8944adc
initial prototype JavaScript structure
Apr 2, 2010
196082e
register user with prototype works
Apr 3, 2010
bc9f670
convert domready to prototype domload events
Apr 3, 2010
b4ff8a1
bug fix prototype password strength missing initial keyup event.
Apr 3, 2010
3ede4fb
added ignored prototype javascript
Apr 3, 2010
05a37fc
converted tabs to prototype
Apr 3, 2010
db92518
first full working prototype version
Apr 4, 2010
5945a76
add final method to configure javascript
Apr 5, 2010
d55eaf0
moved all of the nimble javascript into a nimble namespace
Apr 5, 2010
ca24e4c
move web resource files to dev folder
Apr 8, 2010
cb3fef1
ignore web-app folders
Apr 8, 2010
1d98725
clean javascript filenames
Apr 8, 2010
fb88515
general javascript house cleaning
Apr 8, 2010
f8eded1
added js/css compressing library and compile event script
Apr 8, 2010
2e69515
fix all javascript/css resource references
Apr 8, 2010
4b968cd
nimble namespace missing from tip create calls
Apr 8, 2010
d1f53a7
fixes mismatched prototype to jquery folder
Apr 8, 2010
dd78fdf
bug fixes for nimble namespace and compression patches
Apr 8, 2010
d9c7366
fixes bug introduced with compression patch
Apr 8, 2010
38be8ae
finished compression clean
Apr 8, 2010
60fa064
Final changes for allowing custom User/Profile fields to be editable.
Apr 8, 2010
3fbc3f6
Merge commit 'beddoes/master'
Apr 8, 2010
e34606c
Merge branch 'flowz'
Apr 8, 2010
3a363db
Fixing plugin version from private branch
Apr 8, 2010
945a680
Removing unused code
Apr 8, 2010
ce91562
Closes GH-19 - there were missing table names for nimble social.
Mar 16, 2010
c6b0c09
Fixed tabs v spaces in last commit.
Mar 16, 2010
8e8abe8
Addition of events: beforeregister and afterregister.
Mar 23, 2010
981b88e
Removing unused code
Apr 8, 2010
04269b1
Closes GH-19 - Table name issues and nimble social. Implemented comm…
Mar 29, 2010
42eefc3
Allowing register form to accept values from URL
Mar 29, 2010
a47642a
undo grails upgrade
Apr 8, 2010
ab3e2bb
reproduces patch by Mike Wille - Show validation errors for profile o…
Apr 8, 2010
c947905
reproduces patch by Mike Wille - Final changes for allowing custom Us…
Apr 8, 2010
02973c2
fix missing nimble namespace on js calls
Apr 9, 2010
450a147
nimblesocial is now grails 1.2.2, making nimble also grail 1.2.2
Apr 10, 2010
3cc32a8
Merge branch 'feature/registerevents' into develop
Apr 12, 2010
0798d2b
Tying register form profile fields to configured allowable fields
Apr 12, 2010
645d142
Fixing whitespace
Apr 12, 2010
dbd9b30
Merge branch 'master' of git://github.com/digerata/nimble into featur…
Apr 12, 2010
8d7157f
Merge branch 'feature/registersecurity' into develop
Apr 12, 2010
936c53e
Attempting to correct GH-24
Apr 12, 2010
98478c0
Pulled down new work from Chris
Apr 12, 2010
ee7e4ad
Removed unused style class
Apr 12, 2010
330e34e
Merge branch 'feature/dynamicjs' into develop
Apr 12, 2010
cc0e578
Tying register form profile fields to configured allowable fields
Apr 12, 2010
af62a5d
Removed unused style class
Apr 12, 2010
7e05871
Fixing whitespace
Apr 12, 2010
898c964
Started observing changes in services and filters (no idea how we'd m…
Apr 15, 2010
d2c1e64
Started observing changes in services and filters (no idea how we'd m…
Apr 15, 2010
a679c71
Merge branch 'develop' of git://github.com/bradleybeddoes/nimble into…
Apr 17, 2010
ea16132
merge with bradleybeddoes/nimble/develop
Apr 17, 2010
ed0d3df
moved /web-app/dev/* to /src/*
Apr 21, 2010
b2b110a
Added ability to have SASS compile when project is compiled
Apr 22, 2010
3c8fbf4
Fixes GH-25 - Allow disabling for JS/CSS minification
Apr 23, 2010
1ef71f8
GH-25 Additional switch to turn off resource change modification comp…
Apr 23, 2010
08942fa
GH-25 added missing switch in BuildConfig.groovy
Apr 23, 2010
f019a7c
Merge branch 'feature/disablecompression' into develop
May 2, 2010
5f8a01f
Pushing Nimble to 1.0-SNAPSHOT
May 2, 2010
06ed7a1
Commented out grailsCentral() from BuildConfig.groovy until 1.3 becom…
May 2, 2010
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
55 changes: 29 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@

grails-app/conf/NimbleBootStrap.groovy
grails-app/domain/intient/test/*

.DS_Store
.sass-cache
classes
stacktrace.log
docs.tar.gz

*~
*.ipr
*.iml
*.iws
*.war
web-app/plugins/*
target/
test/reports/*
unzipped/*
docs/*
*.zip
plugin.xml

src/docs

grails-app/i18n/shiro.properties

grails-app/conf/NimbleBootStrap.groovy
grails-app/domain/intient/test/*

.DS_Store
.sass-cache
classes
stacktrace.log
docs.tar.gz

*~
*.ipr
*.iml
*.iws
*.war
web-app/plugins/*
web-app/css/*
web-app/images/*
web-app/js/*
target/
test/reports/*
unzipped/*
docs/*
*.zip
plugin.xml

src/docs

grails-app/i18n/shiro.properties
26 changes: 19 additions & 7 deletions NimbleGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import grails.plugins.nimble.core.UserBase
class NimbleGrailsPlugin {

// the plugin version
def version = "0.4-SNAPSHOT"
def version = "1.0-SNAPSHOT"

// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.1 > *"
Expand All @@ -45,7 +45,7 @@ class NimbleGrailsPlugin {
'grails-app/conf/NimbleBootStrap.groovy',
]

def author = "Bradley Beddoes and open source contributors"
def author = "Bradley Beddoes, Chris Doty, Mike Wille and open source contributors"
def authorEmail = "[email protected]"
def title = "Nimble"
def description = '''\\
Expand All @@ -55,7 +55,7 @@ class NimbleGrailsPlugin {
// URL to the plugin's documentation
def documentation = "http://sites.google.com/site/nimbledoc/"

def observe = ['controllers']
def observe = ['controllers', 'services', 'filters']

def doWithSpring = {
loadNimbleConfig(application)
Expand Down Expand Up @@ -119,23 +119,28 @@ class NimbleGrailsPlugin {
}

def onChange = { event ->
doWithDynamicMethods()
if(event.source) {
injectAuthn(event.source, event.application)
}
}

def onConfigChange = { event ->

}

private void injectAuthn(def clazz, def application) {
private void injectAuthn(def clazz, GrailsApplication grailsApplication) {
def config = grailsApplication.config
GroovyClassLoader classLoader = new GroovyClassLoader(getClass().classLoader)

clazz.metaClass.getAuthenticatedSubject = {
def subject = SecurityUtils.getSubject()
}
clazz.metaClass.getAuthenticatedUser = {
def principal = SecurityUtils.getSubject()?.getPrincipal()
def authUser

if(application.config?.nimble?.implementation?.user)
authUser = grailsApplication.classLoader.loadClass(application.config.nimble.implementation.user).get(principal)
if(config.nimble?.implementation?.user)
authUser = classLoader.loadClass(config.nimble.implementation.user).get(principal)
else
authUser = UserBase.get(principal)

Expand All @@ -155,6 +160,13 @@ class NimbleGrailsPlugin {
// Merging default Nimble config into main application config
config.merge(new ConfigSlurper(GrailsUtil.environment).parse(classLoader.loadClass('DefaultNimbleConfig')))

// Merging default Nimble Social config into main application config if social is used.
try {
config.merge(new ConfigSlurper(GrailsUtil.environment).parse(classLoader.loadClass('DefaultNimbleSocialConfig')))
} catch (Exception ignored) {
// ignore, just use the defaults
}

// Merging user-defined Nimble config into main application config if provided
try {
config.merge(new ConfigSlurper(GrailsUtil.environment).parse(classLoader.loadClass('NimbleConfig')))
Expand Down
20 changes: 10 additions & 10 deletions application.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#Grails Metadata file
#Thu Feb 11 07:30:26 EST 2010
app.grails.version=1.2.1
app.name=nimble
app.servlet.version=2.4
app.version=0.4
plugins.hibernate=1.2.1
plugins.mail=0.6
plugins.shiro=1.0.1
plugins.tomcat=1.2.1
#Grails Metadata file
#Wed Apr 21 20:59:53 CDT 2010
app.grails.version=1.3.0.RC1
app.name=nimble
app.servlet.version=2.4
app.version=0.4
plugins.hibernate=1.3.0.RC1
plugins.mail=0.6
plugins.shiro=1.0.1
plugins.tomcat=1.3.0.RC1
25 changes: 25 additions & 0 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.dependency.resolution = {
inherits "global" // inherit Grails' default dependencies
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsHome()
// grailsCentral()
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'com.mysql:mysql-connector-java:5.1.5'
}

}

nimble {
resources {
nomodcheck = false
nocompilesass = false
nocompress = false
noclean = false
}
}
30 changes: 21 additions & 9 deletions grails-app/conf/DefaultNimbleConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* limitations under the License.
*/

// change the JavaScript library that grails & nimble use by adjusting this value
// valid values: jquery, mootools prototype
grails.views.javascript.library='jquery'

nimble {

tablenames {
Expand All @@ -28,6 +32,8 @@ nimble {
permission = "permission"
levelpermission = "level_permission"
url = "url"
socialmediaaccount = "social_media_account"
socialmediaservice = "social_media_service"
}

fieldnames {
Expand All @@ -41,6 +47,12 @@ nimble {
customcss = ''
}

resources {
jslibrary = grails.views.javascript.library
usejsdev = false
usecssdev = false
}

localusers {
usernames {
minlength = 4
Expand All @@ -51,15 +63,15 @@ nimble {
}
}

fields {
admin {
user['username', 'external', 'federated']
}
enduser {
user['username', 'pass', 'passConfirm']
profile['fullName', 'email']
}
}
fields {
admin {
user = ['username', 'external', 'federated']
}
enduser {
user = ['username', 'pass', 'passConfirm']
profile = ['fullName', 'email']
}
}

passwords {
mustcontain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ class AccountController {

def user = InstanceGenerator.user()
user.profile = InstanceGenerator.profile()
def userFields = grailsApplication.config.nimble.fields.enduser.user
def profileFields = grailsApplication.config.nimble.fields.enduser.profile
user.properties[userFields] = params
user.profile.properties[profileFields] = params

log.debug("Starting new user creation")
[user: user]
Expand All @@ -117,9 +121,11 @@ class AccountController {

def user = InstanceGenerator.user()
user.profile = InstanceGenerator.profile()
def userFields = grailsApplication.config.nimble.fields.enduser.user
def profileFields = grailsApplication.config.nimble.fields.enduser.profile
user.properties[userFields] = params
user.profile.properties[profileFields] = params
user.profile.owner = user
user.properties['username', 'pass', 'passConfirm'] = params
user.profile.properties['fullName', 'email'] = params
user.enabled = grailsApplication.config.nimble.localusers.provision.active
user.external = false

Expand All @@ -137,6 +143,10 @@ class AccountController {
if (user.profile.email == null || user.profile.email.length() == 0)
user.profile.email = 'invalid'

// Allow host application to do some validation, etc.
if(userService.events['beforeregister']) {
userService.events['beforeregister'](user)
}

if (user.hasErrors()) {
log.debug("Submitted values for new user are invalid")
Expand Down Expand Up @@ -170,6 +180,10 @@ class AccountController {
return
}

if(userService.events['afterregister']) {
userService.events['afterregister'](user)
}

log.info("Sending account registration confirmation email to $user.profile.email with subject $grailsApplication.config.nimble.messaging.registration.subject")
if(grailsApplication.config.nimble.messaging.enabled) {
sendMail {
Expand Down Expand Up @@ -303,7 +317,7 @@ class AccountController {
userService.setRandomPassword(user)

log.info("Sending account password reset email to $user.profile.email with subject $grailsApplication.config.nimble.messaging.passwordreset.subject")
if(grailsApplication.config.nimble.messaging.enabled) {
if(grailsApplication.config.nimble.messaging.enabled && !grailsApplication.config.nimble.provision.active) {
sendMail {
to user.profile.email
from grailsApplication.config.nimble.messaging.mail.from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import grails.plugins.nimble.auth.AccountCreatedException
class AuthController {

private static String TARGET = 'grails.plugins.nimble.controller.AuthController.TARGET'

def shiroSecurityManager
def facebookService
def openIDService
Expand Down Expand Up @@ -88,7 +88,7 @@ class AuthController {
catch (IncorrectCredentialsException e) {
log.info "Credentials failure for user '${params.username}'."
log.debug(e)

flash.type = 'error'
flash.message = message(code: "nimble.login.failed.credentials")
}
Expand Down Expand Up @@ -324,7 +324,7 @@ class AuthController {
response.sendError(403)
return
}

def discovered = session.getAttribute("discovered")
ParameterList openIDResponse = new ParameterList(request.getParameterMap());

Expand Down Expand Up @@ -356,7 +356,7 @@ class AuthController {
}
else {
log.debug ("OpenID authentication failure")

flash.type = 'error'
flash.message = message(code: "nimble.login.openid.${service}.internal.error.res")
redirect(action: 'login', params: [active: service])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ class UserController {
redirect action: edit, id: params.id
}
else {
def fields = grailsApplication.config.nimble.fields.admin.user
user.properties[fields] = params
if (!user.validate()) {
log.debug("Updated details for user [$user.id]$user.username are invalid")
render view: 'edit', model: [user: user]
}
else {
def fields = grailsApplication.config.nimble.fields.admin.user
def profileFields = grailsApplication.config.nimble.fields.enduser.profile
user.properties[fields] = params
user.profile.properties[profileFields] = params
if (!user.validate()) {
log.debug("Updated details for user [$user.id]$user.username are invalid")
render view: 'edit', model: [user: user]
}
else {
def updatedUser = userService.updateUser(user)
log.info("Successfully updated details for user [$user.id]$user.username")
flash.type = "success"
Expand All @@ -110,10 +112,10 @@ class UserController {
def save = {
def user = InstanceGenerator.user()
user.profile = InstanceGenerator.profile()
def userFields = grailsApplication.config.nimble.fields.enduser.user
def profileFields = grailsApplication.config.nimble.fields.enduser.profile
user.properties[userFields] = params
user.profile.properties[profileFields] = params
def userFields = grailsApplication.config.nimble.fields.enduser.user
def profileFields = grailsApplication.config.nimble.fields.enduser.profile
user.properties[userFields] = params
user.profile.properties[profileFields] = params
user.enabled = false
user.external = false

Expand Down
5 changes: 3 additions & 2 deletions grails-app/i18n/messages-nimble.properties
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ nimble.view.account.registeraccount.complete.title=Successfully registered accou
nimble.view.account.registeraccount.complete.heading=Successfully registered account
nimble.view.account.registeraccount.complete.descriptive=You've successfully registered for a new account on this system.
nimble.view.account.registeraccount.complete.sentemail=To complete the process an email has been sent to your nominated email address. Please follow the instructions to login for the first time.
nimble.view.account.registeraccount.complete.continue=Continue

nimble.view.account.forgottenpassword.initiate.title=Forgotten Password
nimble.view.account.forgottenpassword.initiate.heading=Forgotten Password
Expand Down Expand Up @@ -202,6 +203,7 @@ nimble.view.user.show.extendedinformation.heading=Extended account information

##########
# Templates
nimble.template.sessionterminated.title=Session Terminated
nimble.template.sessionterminated.descriptive=Unfortunately your session has expired. This usually happens when a page is left open for long periods of time without performing any action. If you're experiencing this problem often contact your helpdesk for assistance.

nimble.template.logins.heading=Logins
Expand Down Expand Up @@ -246,7 +248,6 @@ nimble.template.passwordpolicy=<p>To ensure security passwords must meet the fol
<li>Not previously used as a password on this account</li> \
</ul> \
<p>Ideally set a password that is considered to be in the category 'strongest' by the indicator bar.</p>

nimble.template.accountcreationpolicy=<p>This service integrates with all of the following account providers</p> \
<ul> \
<li>Google</li> \
Expand Down Expand Up @@ -442,4 +443,4 @@ nimble.levelpermission.invalid.second.sector=The second sector is invalid. It mu
nimble.levelpermission.invalid.third.sector=The third sector is invalid. It must not contain seperator (:) characters
nimble.levelpermission.invalid.fourth.sector=The fourth sector is invalid. It must not contain seperator (:) characters
nimble.levelpermission.invalid.fifth.sector=The fifth sector is invalid. It must not contain seperator (:) characters
nimble.levelpermission.invalid.sixth.sector=The sixth sector is invalid. It must not contain seperator (:) characters
nimble.levelpermission.invalid.sixth.sector=The sixth sector is invalid. It must not contain seperator (:) characters
Loading