Grails 仅授予具有用户角色权限的用户访问权限

Grails 仅授予具有用户角色权限的用户访问权限,grails,spring-security,Grails,Spring Security,我得到以下错误 Class org.springframework.expression.spel.SpelEvaluationException Message EL1008E:(pos 0): Field or property 'ADMIN_ROLE' cannot be found on object of type 'org.springframework.security.web.access.expression.WebSecurityExpressionRoot' 我正在尝试访

我得到以下错误

Class
org.springframework.expression.spel.SpelEvaluationException
Message
EL1008E:(pos 0): Field or property 'ADMIN_ROLE' cannot be found on object of type 'org.springframework.security.web.access.expression.WebSecurityExpressionRoot'
我正在尝试访问查看My.GSP,并以
用户角色登录

--

分贝


使用Grails中spring安全插件的默认设置,角色名称必须以前缀
“role\u”
开头,因此将
管理员角色
重命名为
管理员
,将
用户角色
重命名为
角色


解释为什么默认情况下它会这样工作,以及在需要时如何对其进行不同的配置。

您是否100%确定已正确创建管理员角色?我已编辑了我的帖子。我包括了我的数据库截图
import org.springframework.dao.DataIntegrityViolationException
import grails.plugin.springsecurity.annotation.Secured

class MyController {

    static allowedMethods = [save: "POST", update: "POST", delete: "POST"]

    @Secured(['ADMIN_ROLE','USER_ROLE'])
    def index() {
        redirect(action: "list", params: params)
    }
    @Secured(['USER_ROLE'])
    def list(Integer max) {
        params.max = Math.min(max ?: 10, 100)
        [patientInstanceList: Patient.list(params), patientInstanceTotal: Patient.count()]
    }
    @Secured(['USER_ROLE'])
    def create() {
        [patientInstance: new Patient(params)]
    }
    @Secured(['USER_ROLE'])
    def save() {
        def patientInstance = new Patient(params)
        if (!patientInstance.save(flush: true)) {
            render(view: "create", model: [patientInstance: patientInstance])
            return
        }

        flash.message = message(code: 'default.created.message', args: [message(code: 'patient.label', default: 'Patient'), patientInstance.id])
        redirect(action: "show", id: patientInstance.id)
    }