tags:

views:

47

answers:

2

Hi ,

I want to interrupt some specific grails domain class events(read,write,delete,update).Is there any hibernate eventlistner available for grails domain classes.So that all the calls will go through that eventslistner.I tried following def beforeLoad={}, def beforeInsert={} ,etc ..Other than that is there any other way something can be done in service level?

Thanks

A: 

If you want to secure domain objects read about Secure Objects in the Spring Security's manual. There is also the wonderful Grails Acegi Plugin.

Cheers!

lunohodov
A: 

The easiest way to implement an authentication-mechanism is by using Grails Filters (follow the link for a more advanced example) e.g.

class SecurityFilters {
   def filters = {

       loginCheck(controller:'*', action:'*') {

          before = {
             if(!session.user && !actionName.equals('login')) { 
                redirect(action:'login') return false } 
             }
          } 
       } 
    }
 }

If you need more advanced authentication tooling try:

david