cancan-attr-test/README.rdoc

18 lines
700 B
Plaintext
Raw Normal View History

2013-06-28 05:27:08 +00:00
== Cancan should automatically protect updates just like it protects create
To reproduce:
* rake db:migrate
* rails server
* http://localhost:3000/posts
* Create a new post with a User ID of 5
2013-06-28 05:29:29 +00:00
* Note this is prohibited by cancan
2013-06-28 05:27:08 +00:00
* Create a new post with a nil User ID
2013-06-28 05:29:29 +00:00
* Note this is allowed by cancan (you aren't signed in, your user_id is nil)
2013-06-28 05:27:08 +00:00
* Edit your post, and set the User ID to 5
2013-06-28 05:29:29 +00:00
* Note this succeeds
2013-06-28 05:27:08 +00:00
* Edit app/controllers/posts_controller.rb on line 6, uncomment the before_filter line and save
* Create a new post with a nil User ID
2013-06-28 05:29:29 +00:00
* Edit the post and set the User ID to 5
* Note the problem is now fixed, guest users cannot create or update posts that don't belong to them.