grails - Giving access to only User with USER_ROLE Permission -



grails - Giving access to only User with USER_ROLE Permission -

i getting next error

class org.springframework.expression.spel.spelevaluationexception message el1008e:(pos 0): field or property 'admin_role' cannot found on object of type 'org.springframework.security.web.access.expression.websecurityexpressionroot'

i trying access view my.gsp , login user_role

--

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]) homecoming } flash.message = message(code: 'default.created.message', args: [message(code: 'patient.label', default: 'patient'), patientinstance.id]) redirect(action: "show", id: patientinstance.id) }

db

with default settings of spring security plugin in grails role names must start prefix "role_", rename admin_role role_admin , user_role role_user.

this forum post explains why works default, , how can configure differently if required.

grails spring-security

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -