开发者

Grails domain class event listner in service level

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 beforeLoa开发者_高级运维d={}, def beforeInsert={} ,etc ..Other than that is there any other way something can be done in service level?

Thanks


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:

  • Spring Security Plugin
  • Stark Security Plugin
  • Apache Shiro Plugin


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜