Acegi on Grails and plugin ponderance

Date November 14, 2008

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: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • TailRank
  • YahooMyWeb
  • del.icio.us
  • DZone
  • Facebook
  • Reddit
  • StumbleUpon
  • Digg
  • Simpy
  • Technorati

2 Responses to “Acegi on Grails and plugin ponderance”

  1. Burt said:

    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. Graeme Rocher said:

    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

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">