Grails过滤多个操作 [英] Grails filter multiple actions

查看:130
本文介绍了Grails过滤多个操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个过滤器中,我怎样才能匹配同一个控制器的多个动作?

  def filters = {
organisationDelete(controller:organization,action:confirmDelete,delete){
// ...
}
}

在这个映射中,我有confirmDelete作为GET和delete作为POST

解决方案

在旧的ACEGI插件中,我可以编写以逗号分隔的动作。尽管现在Spring安全核心,我必须使用管道。所以,以下解决了这个问题:

$ p $ action:confirmDelete | delete


Within one filter, how can I match more than one action of the same controller?

def filters = {
  organisationDelete(controller: "organisation", action: "confirmDelete, delete") { 
    //...
  }
}

In this mapping I have "confirmDelete" as a GET and "delete" as POST

解决方案

in the old ACEGI plugin I could write the actions separated by comma. Though, now with Spring Security Core I have to use a pipe. So, the following solves the problem

action: "confirmDelete|delete" 

这篇关于Grails过滤多个操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆