ajaxSuccess后无法获取getCurrentUser() [英] cannot get getCurrentUser() after ajaxSuccess

查看:144
本文介绍了ajaxSuccess后无法获取getCurrentUser()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

完成此操作后

after i done with this post, and i already add my code into application.groovy like this

grails.plugin.springsecurity.controllerAnnotations.staticRules = [
[pattern: '/',               access: ['permitAll']],
[pattern: '/error',          access: ['permitAll']],
[pattern: '/index',          access: ['permitAll']],
[pattern: '/shutdown',       access: ['permitAll']],
[pattern: '/assets/**',      access: ['permitAll']],
[pattern: '/**/js/**',       access: ['permitAll']],
[pattern: '/**/css/**',      access: ['permitAll']],
[pattern: '/**/images/**',   access: ['permitAll']],
[pattern: '/**/favicon.ico', access: ['permitAll']],
[pattern: '/login/ajaxSuccess',       access: ['permitAll']],
[pattern: '/login/ajaxSuccess/**',       access: ['permitAll']],
[pattern: '/**/ajaxSuccess/**',       access: ['permitAll']]

]

我的错误日志变成像这样.

这是CorporateUserService.groovy文件

this is corporateUserService.groovy file

def getCurrentCifUser() { //line 949
def cifUser = CifUser.find("from com.vastpalaso.app.cif.CifUser cu where cu.userDetails.user.id=?", [
                    springSecurityService.principal.id //line 950
            ])

            return cifUser
        }

这是在logincotroller中.

and this is in logincotroller..

def cifUser = corporateUserService.getCurrentCifUser() //line 168

推荐答案

尝试将950段更改为:

Try changing like 950 segment to :

def getCurrentCifUser() {
                def cifUser = CifUser.find("from com.vastpalaso.app.cif.CifUser cu where cu.userDetails.user=?", [
                                springSecurityService.currentUser
                ])

                return cifUser
        }

现在回到您的您如何更改

在这里也是参考点

这篇关于ajaxSuccess后无法获取getCurrentUser()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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