Grails, Spring Security core Plugin, Role Management -


i setup new project spring security core plugin. goal simple login/logout, usermanagement (crud) including roles (admin, user). admin should able create users, registration not necessary.

i followed tutorial (docu):

http://grails-plugins.github.io/grails-spring-security-core/guide/tutorials.html#usingcontrollerannotations

now have user, role , userrole domain class , crud functionality. unfortunately role management missing. in best case role should specified admin in "create user process".

another thing noticed cant add other fields generated user class. adding "string lastname" results in following error (run-app):

2015-04-22 19:50:57,749 [localhost-startstop-1] error context.grailscontextloaderlistener  - error initializing application: no signature of method: test.userrole.exists() applicable argument types: (null, java.lang.long) values: [null, 1] possible solutions: exists(long, long), exists(java.io.serializable), list(), first(), wait(), last() message: no signature of method: test.userrole.exists() applicable argument types: (null, java.lang.long) values: [null, 1] possible solutions: exists(long, long), exists(java.io.serializable), list(), first(), wait(), last() 

is there "easy" way implement role-management , fix error?

should switch spring security ui plugin? seems plugin implements lot of functionality dont need.

edit: added field "role" user class specify role during user-creation. should set connection between user , role in userrole entity. added following lines in usercontroller.create method:

def adminrole = new role(authority: 'role_admin').save(flush: true)        def user = new user(params)       user.save(flush: true)        userrole.create user, adminrole, true        respond user 

but guess in wrong place because cant access created user secured urls


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -