|
Hi all,
I've to to modify the selected results from a specifify domain-class based on the user rights. Instead of rewriting the whole application I wondered if there is some way to add the given criteria to each findXYZ at a single point based on the user rights? Cheers Marfinn Software GmbH Firmensitz: Endenicher Straße 262, 53121 Bonn Registergericht: Amtsgericht Bonn, HRB 16233 Geschäftsführer: Martin Hensel, Finn Herpich --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
No one?
----- Original Message ----- From: Finn Herpich [mailto:[hidden email]] To: [hidden email] Sent: Fri, 11 Jun 2010 13:42:15 +0200 Subject: [grails-user] Something like beforeSelect? > Hi all, > > I've to to modify the selected results from a specifify domain-class based > on the user rights. > Instead of rewriting the whole application I wondered if there is some way > to add the given criteria to each findXYZ at a single point based on the > user rights? > > Cheers > > Marfinn Software GmbH > Firmensitz: Endenicher Straße 262, 53121 Bonn > Registergericht: Amtsgericht Bonn, HRB 16233 > Geschäftsführer: Martin Hensel, Finn Herpich > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > Marfinn Software GmbH Firmensitz: Endenicher Straße 262, 53121 Bonn Registergericht: Amtsgericht Bonn, HRB 16233 Geschäftsführer: Martin Hensel, Finn Herpich --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
I suppose there is currently no way to achieve this without rewriting
your application. Sorry. It might be a really handy feature, though. Maybe, you could create a feature request in JIRA for that. On 15 June 2010 13:12, Finn Herpich <[hidden email]> wrote: > No one? > > ----- Original Message ----- > From: Finn Herpich > [mailto:[hidden email]] > To: [hidden email] > Sent: > Fri, 11 Jun 2010 13:42:15 +0200 > Subject: [grails-user] Something like > beforeSelect? > > >> Hi all, >> >> I've to to modify the selected results from a specifify domain-class based >> on the user rights. >> Instead of rewriting the whole application I wondered if there is some way >> to add the given criteria to each findXYZ at a single point based on the >> user rights? >> >> Cheers >> >> Marfinn Software GmbH >> Firmensitz: Endenicher Straße 262, 53121 Bonn >> Registergericht: Amtsgericht Bonn, HRB 16233 >> Geschäftsführer: Martin Hensel, Finn Herpich >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > Marfinn Software GmbH > Firmensitz: Endenicher Straße 262, 53121 Bonn > Registergericht: Amtsgericht Bonn, HRB 16233 > Geschäftsführer: Martin Hensel, Finn Herpich > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > -- Viele Grüße / Best regards, Björn Wilmsmann --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
well,
It will not be easy to do that, but I think it is possible. It is the same mechanism that the multi-tenant plugin works. Based on the tenant context (you'd have to define how your context would be defined), the plugin just add a condition to every findXXX. Take a look on its source code, it may help you... []s, Lucas Frare Teixeira .·. - [hidden email] - lucastex.com.br - blog.lucastex.com - twitter.com/lucastex 2010/6/15 Björn Wilmsmann <[hidden email]> I suppose there is currently no way to achieve this without rewriting |
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
Very good idea.
----- Original Message ----- From: Lucas F. A. Teixeira [mailto:[hidden email]] To: [hidden email] Sent: Tue, 15 Jun 2010 13:32:48 +0200 Subject: Re: [grails-user] Something like beforeSelect? > well, > > It will not be easy to do that, but I think it is possible. > It is the same mechanism that the multi-tenant plugin works. Based on the > tenant context (you'd have to define how your context would be defined), the > plugin just add a condition to every findXXX. > > Take a look on its source code, it may help you... > > []s, > > > Lucas Frare Teixeira .·. > - [hidden email] > - lucastex.com.br > - blog.lucastex.com > - twitter.com/lucastex > > > 2010/6/15 Björn Wilmsmann <[hidden email]> > > > I suppose there is currently no way to achieve this without rewriting > > your application. Sorry. > > > > It might be a really handy feature, though. Maybe, you could create a > > feature request in JIRA for that. > > > > On 15 June 2010 13:12, Finn Herpich <[hidden email]> > > wrote: > > > No one? > > > > > > ----- Original Message ----- > > > From: Finn Herpich > > > [mailto:[hidden email]] > > > To: [hidden email] > > > Sent: > > > Fri, 11 Jun 2010 13:42:15 +0200 > > > Subject: [grails-user] Something like > > > beforeSelect? > > > > > > > > >> Hi all, > > >> > > >> I've to to modify the selected results from a specifify domain-class > > based > > >> on the user rights. > > >> Instead of rewriting the whole application I wondered if there is some > > way > > >> to add the given criteria to each findXYZ at a single point based on > the > > >> user rights? > > >> > > >> Cheers > > >> > > >> Marfinn Software GmbH > > >> Firmensitz: Endenicher Straße 262, 53121 Bonn > > >> Registergericht: Amtsgericht Bonn, HRB 16233 > > >> Geschäftsführer: Martin Hensel, Finn Herpich > > >> > > >> > > >> --------------------------------------------------------------------- > > >> To unsubscribe from this list, please visit: > > >> > > >> http://xircles.codehaus.org/manage_email > > >> > > >> > > >> > > > > > > Marfinn Software GmbH > > > Firmensitz: Endenicher Straße 262, 53121 Bonn > > > Registergericht: Amtsgericht Bonn, HRB 16233 > > > Geschäftsführer: Martin Hensel, Finn Herpich > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe from this list, please visit: > > > > > > http://xircles.codehaus.org/manage_email > > > > > > > > > > > > > > > > > -- > > Viele Grüße / Best regards, > > Björn Wilmsmann > > > > --------------------------------------------------------------------- > > To unsubscribe from this list, please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > > Marfinn Software GmbH Firmensitz: Endenicher Straße 262, 53121 Bonn Registergericht: Amtsgericht Bonn, HRB 16233 Geschäftsführer: Martin Hensel, Finn Herpich --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Could you leave a couple of lines here if you find a good way of doing this? I'm currently using the multi-tenant plugin in a project, but it's pretty much unmaintained so I've been thinking of writing my own version with just the stuff I need.
- Kim A. Betti
Have a nice day! |
|
When I wrote the multi-tenant plugin, I figured this would be a common request, so I pulled the functionality into another plugin - falcone-util plugin. There is an eventing system in the plugin that allows for the interception of Hibernate Criteria and Query objects. By adding your own custom event handler, you can intercept all Criteria and Query objects and modify them. This is the applicable part of the falcone-util plugin documentation. I've added the code that the multi-tenant plugin uses so you can see how it works:
Subscribing to events in a normal Grails Application
To subscribe to events in a normal grails application, create a file
called grails-app/conf/events.groovy. The builder syntax is the exact
same as the example above, with the exception that you declare an
initial "events" closure.
grails-app/conf/events.groovy: On Jun 15, 2010, at 9:15 AM, Kimble wrote:
|
|
Kim
When you say the multi-tenant plugin is unmaintained what are you looking for. I am using it is many projects and do upgrades and releases to the plugin when required. Currently there are not issues in JIRA for either the Multi-tenant or falcone plugin so I have not done a release. I am currently working on some additional plugins to support quartz in multi tenant and to allow for a centralized configuration application as we have several SAAS applications with 1000+ users each with their own database using that plugin. I am planning on upgrading to the latest version of grails 1.3.x as soon as it stablizes. Let me know if there are features you need as I monitor the mailing list and try to address issues as I can Scott Ryan On Jun 15, 2010, at 2:17 PM, Eric Martineau wrote:
|
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
Maybe a bit late for an answer,
but depending on your needs the Hibernate Filter plugin might solve this for you in a nice way. I'm using it with a patch from forums to support runtime parameters to it, but according to the Plugin page it seems to be implemented as of June 6:th. /Claes > To: [hidden email] > From: [hidden email] > Date: Fri, 11 Jun 2010 13:42:15 +0200 > Subject: [grails-user] Something like beforeSelect? > > Hi all, > > I've to to modify the selected results from a specifify domain-class based on the user rights. > Instead of rewriting the whole application I wondered if there is some way to add the given criteria to each findXYZ at a single point based on the user rights? > > Cheers > > Marfinn Software GmbH > Firmensitz: Endenicher Straße 262, 53121 Bonn > Registergericht: Amtsgericht Bonn, HRB 16233 > Geschäftsführer: Martin Hensel, Finn Herpich > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > Fira in våren med nya smileys till Messenger. Klicka här! |
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
I'm still open to all since I'm currently ill I hadn't have time to implement something.
What patch exactly? Cheers ----- Original Message ----- From: Claes Svensson [mailto:[hidden email]] To: [hidden email] Sent: Wed, 16 Jun 2010 07:39:57 +0200 Subject: RE: [grails-user] Something like beforeSelect? > > Maybe a bit late for an answer, > > but depending on your needs the Hibernate Filter plugin might solve > this for you in a nice way. I'm using it with a patch from forums > to support runtime parameters to it, but according to the Plugin > page it seems to be implemented as of June 6:th. > > /Claes > > > To: [hidden email] > > From: [hidden email] > > Date: Fri, 11 Jun 2010 13:42:15 +0200 > > Subject: [grails-user] Something like beforeSelect? > > > > Hi all, > > > > I've to to modify the selected results from a specifify domain-class based > on the user rights. > > Instead of rewriting the whole application I wondered if there is some way > to add the given criteria to each findXYZ at a single point based on the > user rights? > > > > Cheers > > > > Marfinn Software GmbH > > Firmensitz: Endenicher Straße 262, 53121 Bonn > > Registergericht: Amtsgericht Bonn, HRB 16233 > > Geschäftsführer: Martin Hensel, Finn Herpich > > > > > > --------------------------------------------------------------------- > > To unsubscribe from this list, please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > _________________________________________________________________ > Hotmail i mobilen på 5 sekunder! > http://new.windowslivemobile.msn.com/SE-SE/windows-live-hotmail/default.aspx Marfinn Software GmbH Firmensitz: Endenicher Straße 262, 53121 Bonn Registergericht: Amtsgericht Bonn, HRB 16233 Geschäftsführer: Martin Hensel, Finn Herpich --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
Hi Eric,
sounds great, but I can't figure out how you access the currently logged-in user/tenant. Cheers ----- Original Message ----- From: Eric Martineau [mailto:[hidden email]] To: [hidden email] Sent: Tue, 15 Jun 2010 22:17:31 +0200 Subject: Re: [grails-user] Re: Something like beforeSelect? > When I wrote the multi-tenant plugin, I figured this would be a common > request, so I pulled the functionality into another plugin - falcone-util > plugin. There is an eventing system in the plugin that allows for the > interception of Hibernate Criteria and Query objects. By adding your own > custom event handler, you can intercept all Criteria and Query objects and > modify them. This is the applicable part of the falcone-util plugin > documentation. I've added the code that the multi-tenant plugin uses so you > can see how it works: > > Subscribing to events in a normal Grails Application > To subscribe to events in a normal grails application, create a file called > grails-app/conf/events.groovy. The builder syntax is the exact same as the > example above, with the exception that you declare an initial "events" > closure. > > grails-app/conf/events.groovy: > > consumers = { > > hibernate.criteriaCreated { > > CriteriaContext context-> > > boolean hasAnnotation = > TenantUtils.isAnnotated(context.entityClass) > if (context.entityClass == null || hasAnnotation) { > final Integer tenant = ctx.currentTenant.get(); > context.criteria.add(Expression.eq("tenantId", tenant)); > } > > } > } > > > > > On Jun 15, 2010, at 9:15 AM, Kimble wrote: > > > > > Could you leave a couple of lines here if you find a good way of doing > this? > > I'm currently using the multi-tenant plugin in a project, but it's pretty > > much unmaintained so I've been thinking of writing my own version with > just > > the stuff I need. > > > > ----- > > - Kim > > Have a nice day! > > -- > > View this message in context: > http://grails.1312388.n4.nabble.com/Something-like-beforeSelect-tp2251679p2256157.html > > Sent from the Grails - user mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > To unsubscribe from this list, please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > -- > > Small Business Growth Expert > ERIC MARTINEAU > Chief Software Architect > > > > > > > > Marfinn Software GmbH Firmensitz: Endenicher Straße 262, 53121 Bonn Registergericht: Amtsgericht Bonn, HRB 16233 Geschäftsführer: Martin Hensel, Finn Herpich --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
Ok, SecurityUtils works pretty fine for this ;)
----- Original Message ----- From: Finn Herpich [mailto:[hidden email]] To: [hidden email] Sent: Wed, 16 Jun 2010 11:15:40 +0200 Subject: Re: [grails-user] Re: Something like beforeSelect? > Hi Eric, > > sounds great, but I can't figure out how you access the currently logged-in > user/tenant. > > Cheers > > ----- Original Message ----- > From: Eric Martineau > [mailto:[hidden email]] > To: [hidden email] > Sent: Tue, 15 Jun > 2010 22:17:31 +0200 > Subject: Re: [grails-user] Re: Something like > beforeSelect? > > > > When I wrote the multi-tenant plugin, I figured this would be a common > > request, so I pulled the functionality into another plugin - falcone-util > > plugin. There is an eventing system in the plugin that allows for the > > interception of Hibernate Criteria and Query objects. By adding your own > > custom event handler, you can intercept all Criteria and Query objects and > > modify them. This is the applicable part of the falcone-util plugin > > documentation. I've added the code that the multi-tenant plugin uses so > you > > can see how it works: > > > > Subscribing to events in a normal Grails Application > > To subscribe to events in a normal grails application, create a file > called > > grails-app/conf/events.groovy. The builder syntax is the exact same as the > > example above, with the exception that you declare an initial "events" > > closure. > > > > grails-app/conf/events.groovy: > > > > consumers = { > > > > hibernate.criteriaCreated { > > > > CriteriaContext context-> > > > > boolean hasAnnotation = > > TenantUtils.isAnnotated(context.entityClass) > > if (context.entityClass == null || hasAnnotation) { > > final Integer tenant = ctx.currentTenant.get(); > > context.criteria.add(Expression.eq("tenantId", tenant)); > > } > > > > } > > } > > > > > > > > > > On Jun 15, 2010, at 9:15 AM, Kimble wrote: > > > > > > > > Could you leave a couple of lines here if you find a good way of doing > > this? > > > I'm currently using the multi-tenant plugin in a project, but it's > pretty > > > much unmaintained so I've been thinking of writing my own version with > > just > > > the stuff I need. > > > > > > ----- > > > - Kim > > > Have a nice day! > > > -- > > > View this message in context: > > > http://grails.1312388.n4.nabble.com/Something-like-beforeSelect-tp2251679p2256157.html > > > Sent from the Grails - user mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > > To unsubscribe from this list, please visit: > > > > > > http://xircles.codehaus.org/manage_email > > > > > > > > > > -- > > > > Small Business Growth Expert > > ERIC MARTINEAU > > Chief Software Architect > > > > > > > > > > > > > > > > > > Marfinn Software GmbH > Firmensitz: Endenicher Straße 262, 53121 Bonn > Registergericht: Amtsgericht Bonn, HRB 16233 > Geschäftsführer: Martin Hensel, Finn Herpich > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > Marfinn Software GmbH Firmensitz: Endenicher Straße 262, 53121 Bonn Registergericht: Amtsgericht Bonn, HRB 16233 Geschäftsführer: Martin Hensel, Finn Herpich --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
Here it is...
http://grails.1312388.n4.nabble.com/How-To-Use-authenticateService-in-Hiberate-Filters-td1566612.html#a1572234 ...but as it seems like the latest release adds support for this you may not need to use this. It's not an "out-of-the-box" patch, so go for the official release if possible. /Claes > To: [hidden email] > From: [hidden email] > Date: Wed, 16 Jun 2010 08:36:43 +0200 > Subject: RE: [grails-user] Something like beforeSelect? > > I'm still open to all since I'm currently ill I hadn't have time to implement something. > > What patch exactly? > > Cheers > > ----- Original Message ----- > From: Claes Svensson > [mailto:[hidden email]] > To: [hidden email] > Sent: Wed, 16 > Jun 2010 07:39:57 +0200 > Subject: RE: [grails-user] Something like > beforeSelect? > > > > > > Maybe a bit late for an answer, > > > > but depending on your needs the Hibernate Filter plugin might solve > > this for you in a nice way. I'm using it with a patch from forums > > to support runtime parameters to it, but according to the Plugin > > page it seems to be implemented as of June 6:th. > > > > /Claes > > > > > To: [hidden email] > > > From: [hidden email] > > > Date: Fri, 11 Jun 2010 13:42:15 +0200 > > > Subject: [grails-user] Something like beforeSelect? > > > > > > Hi all, > > > > > > I've to to modify the selected results from a specifify domain-class based > > on the user rights. > > > Instead of rewriting the whole application I wondered if there is some way > > to add the given criteria to each findXYZ at a single point based on the > > user rights? > > > > > > Cheers > > > > > > Marfinn Software GmbH > > > Firmensitz: Endenicher Straße 262, 53121 Bonn > > > Registergericht: Amtsgericht Bonn, HRB 16233 > > > Geschäftsführer: Martin Hensel, Finn Herpich > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe from this list, please visit: > > > > > > http://xircles.codehaus.org/manage_email > > > > > > > > > > _________________________________________________________________ > > Hotmail i mobilen på 5 sekunder! > > http://new.windowslivemobile.msn.com/SE-SE/windows-live-hotmail/default.aspx > > Marfinn Software GmbH > Firmensitz: Endenicher Straße 262, 53121 Bonn > Registergericht: Amtsgericht Bonn, HRB 16233 > Geschäftsführer: Martin Hensel, Finn Herpich > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > Chatta från inkorgen. Se möjligheterna med Hotmail! Klicka här! |
|
In reply to this post by Eric Martineau
This is excellent Eric!
Lucas Lucas Frare Teixeira .·. - [hidden email] - lucastex.com.br - blog.lucastex.com - twitter.com/lucastex On Tue, Jun 15, 2010 at 5:17 PM, Eric Martineau <[hidden email]> wrote:
|
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
We use the hibernate filter for that as well and it has worked well in the multi tenant arena as well
Scott Ryan On Jun 16, 2010, at 12:36 AM, Finn Herpich wrote: > I'm still open to all since I'm currently ill I hadn't have time to implement something. > > What patch exactly? > > Cheers > > ----- Original Message ----- > From: Claes Svensson > [mailto:[hidden email]] > To: [hidden email] > Sent: Wed, 16 > Jun 2010 07:39:57 +0200 > Subject: RE: [grails-user] Something like > beforeSelect? > > >> >> Maybe a bit late for an answer, >> >> but depending on your needs the Hibernate Filter plugin might solve >> this for you in a nice way. I'm using it with a patch from forums >> to support runtime parameters to it, but according to the Plugin >> page it seems to be implemented as of June 6:th. >> >> /Claes >> >>> To: [hidden email] >>> From: [hidden email] >>> Date: Fri, 11 Jun 2010 13:42:15 +0200 >>> Subject: [grails-user] Something like beforeSelect? >>> >>> Hi all, >>> >>> I've to to modify the selected results from a specifify domain-class based >> on the user rights. >>> Instead of rewriting the whole application I wondered if there is some way >> to add the given criteria to each findXYZ at a single point based on the >> user rights? >>> >>> Cheers >>> >>> Marfinn Software GmbH >>> Firmensitz: Endenicher Straße 262, 53121 Bonn >>> Registergericht: Amtsgericht Bonn, HRB 16233 >>> Geschäftsführer: Martin Hensel, Finn Herpich >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >> >> _________________________________________________________________ >> Hotmail i mobilen på 5 sekunder! >> http://new.windowslivemobile.msn.com/SE-SE/windows-live-hotmail/default.aspx > > Marfinn Software GmbH > Firmensitz: Endenicher Straße 262, 53121 Bonn > Registergericht: Amtsgericht Bonn, HRB 16233 > Geschäftsführer: Martin Hensel, Finn Herpich > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
So, I've solved it using Erics wonderful falcone-util:
consumers = { hibernate.criteriaCreated { CriteriaContext context -> try { String username = SecurityUtils.subject.principal if(context.entityClass == Tracker) { ShiroUser user = ShiroUser.findByUsername(username) context.criteria.createCriteria('users').add(Expression.eq('id', user.id)) } } catch(all) { } } } Works pretty fine =) ----- Original Message ----- From: Scott Ryan [mailto:[hidden email]] To: [hidden email] Sent: Wed, 16 Jun 2010 14:19:09 +0200 Subject: Re: [grails-user] Something like beforeSelect? > We use the hibernate filter for that as well and it has worked well in the > multi tenant arena as well > > > Scott Ryan > > > > > > > > > On Jun 16, 2010, at 12:36 AM, Finn Herpich wrote: > > > I'm still open to all since I'm currently ill I hadn't have time to > implement something. > > > > What patch exactly? > > > > Cheers > > > > ----- Original Message ----- > > From: Claes Svensson > > [mailto:[hidden email]] > > To: [hidden email] > > Sent: Wed, 16 > > Jun 2010 07:39:57 +0200 > > Subject: RE: [grails-user] Something like > > beforeSelect? > > > > > >> > >> Maybe a bit late for an answer, > >> > >> but depending on your needs the Hibernate Filter plugin might solve > >> this for you in a nice way. I'm using it with a patch from forums > >> to support runtime parameters to it, but according to the Plugin > >> page it seems to be implemented as of June 6:th. > >> > >> /Claes > >> > >>> To: [hidden email] > >>> From: [hidden email] > >>> Date: Fri, 11 Jun 2010 13:42:15 +0200 > >>> Subject: [grails-user] Something like beforeSelect? > >>> > >>> Hi all, > >>> > >>> I've to to modify the selected results from a specifify domain-class > based > >> on the user rights. > >>> Instead of rewriting the whole application I wondered if there is some > way > >> to add the given criteria to each findXYZ at a single point based on the > >> user rights? > >>> > >>> Cheers > >>> > >>> Marfinn Software GmbH > >>> Firmensitz: Endenicher Straße 262, 53121 Bonn > >>> Registergericht: Amtsgericht Bonn, HRB 16233 > >>> Geschäftsführer: Martin Hensel, Finn Herpich > >>> > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe from this list, please visit: > >>> > >>> http://xircles.codehaus.org/manage_email > >>> > >>> > >> > >> _________________________________________________________________ > >> Hotmail i mobilen på 5 sekunder! > >> > http://new.windowslivemobile.msn.com/SE-SE/windows-live-hotmail/default.aspx > > > > Marfinn Software GmbH > > Firmensitz: Endenicher Straße 262, 53121 Bonn > > Registergericht: Amtsgericht Bonn, HRB 16233 > > Geschäftsführer: Martin Hensel, Finn Herpich > > > > > > --------------------------------------------------------------------- > > To unsubscribe from this list, please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > Marfinn Software GmbH Firmensitz: Endenicher Straße 262, 53121 Bonn Registergericht: Amtsgericht Bonn, HRB 16233 Geschäftsführer: Martin Hensel, Finn Herpich --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Finn Herpich | Marfinn Software GmbH
Depending on the security framework you use (We use Shiro) you always have access to the principal from within the application and can use that to get to the user record. We do this for auditing every move a logged in user makes. There is also a call within the multi tenant plugin that gives you access to the current tenant. We have built a filter that tracks all logged in users per tenant during their logged in life so we can send them real time messages and chats as they are logged in and we have developed a multi tenant manager for managing all the users from the tenants we have active.
Scott Ryan On Jun 16, 2010, at 3:15 AM, Finn Herpich wrote: > Hi Eric, > > sounds great, but I can't figure out how you access the currently logged-in user/tenant. > > Cheers > > ----- Original Message ----- > From: Eric Martineau > [mailto:[hidden email]] > To: [hidden email] > Sent: Tue, 15 Jun > 2010 22:17:31 +0200 > Subject: Re: [grails-user] Re: Something like > beforeSelect? > > >> When I wrote the multi-tenant plugin, I figured this would be a common >> request, so I pulled the functionality into another plugin - falcone-util >> plugin. There is an eventing system in the plugin that allows for the >> interception of Hibernate Criteria and Query objects. By adding your own >> custom event handler, you can intercept all Criteria and Query objects and >> modify them. This is the applicable part of the falcone-util plugin >> documentation. I've added the code that the multi-tenant plugin uses so you >> can see how it works: >> >> Subscribing to events in a normal Grails Application >> To subscribe to events in a normal grails application, create a file called >> grails-app/conf/events.groovy. The builder syntax is the exact same as the >> example above, with the exception that you declare an initial "events" >> closure. >> >> grails-app/conf/events.groovy: >> >> consumers = { >> >> hibernate.criteriaCreated { >> >> CriteriaContext context-> >> >> boolean hasAnnotation = >> TenantUtils.isAnnotated(context.entityClass) >> if (context.entityClass == null || hasAnnotation) { >> final Integer tenant = ctx.currentTenant.get(); >> context.criteria.add(Expression.eq("tenantId", tenant)); >> } >> >> } >> } >> >> >> >> >> On Jun 15, 2010, at 9:15 AM, Kimble wrote: >> >>> >>> Could you leave a couple of lines here if you find a good way of doing >> this? >>> I'm currently using the multi-tenant plugin in a project, but it's pretty >>> much unmaintained so I've been thinking of writing my own version with >> just >>> the stuff I need. >>> >>> ----- >>> - Kim >>> Have a nice day! >>> -- >>> View this message in context: >> http://grails.1312388.n4.nabble.com/Something-like-beforeSelect-tp2251679p2256157.html >>> Sent from the Grails - user mailing list archive at Nabble.com. >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >> >> -- >> >> Small Business Growth Expert >> ERIC MARTINEAU >> Chief Software Architect >> >> >> >> >> >> >> >> > > Marfinn Software GmbH > Firmensitz: Endenicher Straße 262, 53121 Bonn > Registergericht: Amtsgericht Bonn, HRB 16233 > Geschäftsführer: Martin Hensel, Finn Herpich > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by scryan
First I just want to say that I hope I didn't offend you by saying that the plugin is unmaintained, I'm very grateful that you've taken the responsibility of maintaining it.
You say that there are no open jira issues for either multi-tenant, nor falcone-util? http://jira.codehaus.org/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+GRAILSPLUGINS+AND+component+%3D+Grails-Multi-Tenant+AND+resolution+%3D+Unresolved+AND+priority+%3D+Major+ORDER+BY+key+DESC&mode=hide Is there another jira site for these plugins that I'm not aware of? My biggest annoyance with the plugins is the use of internal sun apis that blows up the compilation process from time to time. I'm currently trying out a version where I've replaced the sun imports. It seems to be working fine with Grails 1.3.2. Not that I've been able to test it properly with all the other problems I've been having with the upgrade to 1.3.2..
- Kim A. Betti
Have a nice day! |
| Powered by Nabble | Edit this page |
