Generated PersonController expects Authority to contain word ROLE
Posted
by Chip L
on Stack Overflow
See other posts from Stack Overflow
or by Chip L
Published on 2009-07-16T00:48:23Z
Indexed on
2010/03/20
7:11 UTC
Read the original article
Hit count: 152
I'm brand new to acegi and relatively new to Grails.
I just followed the tutorial to set up a new role and a new user. Every time I saved the user (with a role checked), it saved the user information fine, but not the role associated with the user.
I finally dug into the controller code that was generated, and noticed this:
private void addRoles(person) {
for (String key in params.keySet()) {
if (key.contains('ROLE') && 'on' == params.get(key)) {
Authority.findByAuthority(key).addToPeople(person)
}
}
}
So to be sure I was interpreting it correctly, I added the word ROLE to my authorties, and it worked like a charm. Am I missing something obvious, is this a bug, or.......?
The examples showed simple role names like "user" or "manager".
© Stack Overflow or respective owner