>
> I've recently started using grails (v1.1.1) at work and wanted to build
> security into my project from the beginning using spring-security/acegi
> (v0.5.2).
>
> I have successfully followed the
>
http://www.grails.org/AcegiSecurity+Plugin+-+Basic+Tutorial Basic Tutorial
> using Requestmap and so far everything has worked pretty well. However, I
> have come across some unexpected behaviours I would like to confirm work as
> designed or find existing workarounds.
>
> Users without Roles are unable to login
> I found it unusual that Users have to be associated with a Role before being
> able to login via the LoginController. When a User not associated with a
> Role attempts to login via the LoginController, the error in grails is
> "ERROR springsecurity.GrailsDaoImpl - User [james] has no
> GrantedAuthority". I expected to define an admin role (ROLE_ADMIN), one
> admin user (admin), and associate the two; then define a bunch of users
> without having to associate them with any Role (less maintenance). Then I
> could use the 3 roles: IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED,
> and IS_AUTHENTICATED_ANONYMOUSLY to control access to areas of my system
> that don't require specific Roles.
>
> The Requestmaps for this use case would be something like:
> new Requestmap(url: "/admin/**", configAttribute: "ROLE_ADMIN").save()
> new Requestmap(url: "/event/**", configAttribute:
> "IS_AUTHENTICATED_FULLY").save()
>
> Given this scenario, Users without a Role are unable to login and go to
> /event. Seems like overkill to associate every User with a Role when I am
> using the IS_AUTHENTICATED* Roles.
>
> Is this a valid use case or is it pretty much standard to require a User to
> have a Role? Seems to me the IS_AUTHENTICATED* Roles indicate the user
> provided a valid username/password and can access the system with extra
> defined Roles.
>
> Spring-Security Allows Delete for Wrong User
> I wanted to restrict Delete actions to only admins (as above I am using the
> Requestmap strategy) on one of my simple models (Event). I have 2 Roles
> (ROLE_ADMIN and ROLE_USER) and 2 Users (admin and james). User admin is
> ROLE_ADMIN and User james is ROLE_USER.
>
> I have 1 Requestmap to only allow admins to delete Events:
> new Requestmap(url: "/event/delete/**", configAttribute:
> "ROLE_ADMIN").save()
>
> What I expect is only the admin user can delete Events, however what I
> observed was my james User was able to view the event (/event/show/1) and
> click the Delete button to delete the Event. When my james User goes
> directly to the URL, /event/delete/2, it correctly responds with "Sorry,
> you're not authorized to view this page.". This is what I would expect to
> see when clicking the Delete button. Perhaps I don't know enough about
> submitButtons and controllers (I have not changed the auto-generated views
> or controllers). I realize I can disabled the Delete button using the
> ifAnyGranted taglib. I just expected the Delete button would traverse the
> same path to the controller, thus allowing acegi to prevent access.
>
> What is the Delete button doing that prevents acegi from preventing access?