Acegi on Grails and plugin ponderance

November 14th, 2008 by mgkimsal Leave a reply »

There’s a few little pain points I just encountered setting up Acegi on Grails.  I appreciate the ‘grails generate-manager’ functionality, and the ‘grails generate-registration’ stuff as well, and the basic tutorial is a good start.  Unfortunately, they still left off the part about having to define a role (using the role controller, for example) before the self-registration works.  Specifically, you’ll need to define a ‘ROLE_USER’ in the Role controller to match the defaultRole in the security{} block in the SecurityConfig.groovy file.

I just added 

         def r1 = new Role(authority:”ROLE_USER”, description:”User”).save()

         def r2 = new Role(authority:”ROLE_ADMIN”, description:”Admin”).save()

in my BootStrap.groovy file and this gets me going.

 

On a related note about Grails plugins, I’m already concerned about directive name clashes.  When a plugin is registered, it can expose extra functionality to the grails command line user.  In the above example, the Acegi plugin also gives you “grails generate-manager”, “grails generate-registration”, among others.  Those names are pretty generic – no other Grails plugin can really depend on being able to use the term ‘generate-manager’ because it’ll conflict with the Acegi plugin should it also be installed.  

I’d think it would make more sense to have a convention whereby all plugins’ functionality was prefixed by the plugin name, so the above would be “grails acegi-generate-manager”, for example.

 

Share and Enjoy:
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati
Advertisement

2 comments

  1. Burt says:

    The docs on the wiki are publicly editable. Or you could write up a feature request at http://jira.codehaus.org/browse/GRAILSPLUGINS under grails-acegi.

  2. Actually other Grails plugins can use those names. If Grails finds multiple scripts that match the name “generate-manager” it will give you a choice of which one to run.

Leave a Reply