|
Hi,
I have a practice project that I am working on to experiment with acegi and audit logging plugin. When I update a user and tick a role, the role does not get saved to the users' roles.
I noticed something on the codes. In the User Controller, when saving a user, I believe that this is the section of the code that saves the roles: private void addRoles(person) {
for (String key in params.keySet()) { println params if (key.contains('ROLE') && 'on' == params.get(key)) {
Authority.findByAuthority(key).addToPeople(person) } }
} It seems to be looking for an input field with name ROLE. However, the generated Person edit.gsp:
GSP: <g:each var="entry" in="${roleMap}"> <li>${entry.key.authority.encodeAsHTML()}
<g:checkBox name="${entry.key.authority}" value="${entry.value}"/> </li>
</g:each> I have tested with Authorities starting with ROLE and others that do not, and only those roles that start with the prefix gets saved.
Is this a design by default? What is the reason behind this? thanks! Jonathan |
|
As far as I know this is an requirement by Spring Security that role names have to start with the prefix "ROLE_"
cheers david On Mon, Feb 16, 2009 at 11:14 AM, Jonathan Andrew Ong <[hidden email]> wrote: Hi, -- ____david_trattnig_____ http://photos.bitfusion.org |
|
Hi David,
Thanks for the quick reply. Will keep that in mind. Regards, Jonathan
On Mon, Feb 16, 2009 at 1:47 PM, David Trattnig <[hidden email]> wrote: As far as I know this is an requirement by Spring Security that role names have to start with the prefix "ROLE_" |
| Powered by Nabble | Edit this page |
