multi-tenant / grails-multi-tenant-single-db

Multi Tenant implementation for single database environments - Use grails-filtering and grails-hibernate-hijacker
Apache License 2.0
32 stars 25 forks source link

Pull request for #18: Change the registration order of the multi-tenant filter #27

Closed vsaar closed 11 years ago

vsaar commented 11 years ago

Using the changes from this pull request, the tenant filter's position is affected by the multiTenant.resolveTenantBeforeLogin config property. Setting it to true results in the filter being registered before Spring Security's form login filter.

pmenhart commented 11 years ago

Very nice! I had the same problem, solved it with a metaclass workaround: overriding the method getWebXmlFilterOrder() in <application>/scripts/_Events.groovy:

 eventWebXmlStart = { String tmpfile ->
     /** Change the order of filters: multitenant must run before springsecuritycore (position 1100)
      *  See grails.plugin.webxml.FilterManager and plugins/webxml-1.4.1/scripts/_Events.groovy */
     def multitenantPlugin = pluginManager.getGrailsPlugin("multi-tenant-single-db")
     multitenantPlugin.instance.metaClass.getWebXmlFilterOrder = { [tenantFilter: 1050] }
 }
vsaar commented 11 years ago

@sronderos, I just realized today that you asked for documentation of this feature in the merge commit. I also saw that you already took care of if, so thanks for that.

I guess it would be better to post that on Github as a comment instead of in the commit message. Or use the @username syntax as supported by Github, which will send a notification.