Hi,
I'm writing functional tests for my Hobo controllers. It seems that if
I just post a 'create' request the permissions restrictions are being
ignored. I've set up a basic example in my app to check what was going
on. So I have a class called Widget, which should dissallow all create
requests. See model below:
class Widget < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
content :text, :required
timestamps
end
def create_permitted?
false
end
....
end
However, if I run this test below, it creates a new record, and hence
passes:
assert_difference('Widget.count') do
post :create, :widget => {:content => 'test data'}
end
If I change the test by adding a get request to the 'new' method, it
fails to create a new record as it should, and fails:
assert_difference('Widget.count') do
get :new
post :create, :widget => {:content => 'test data'}
end
Surely this is wrong? What's to stop a malicious user simply posting
data directly to my app to circumvent the Hobo permissions?
Please let me know what's happening here and if I've maybe understood
the problem?
Thanks
Brent
--
You received this message because you are subscribed to the Google Groups "Hobo Users" group.
To post to this group, send email to
hobo...@googlegroups.com.
To unsubscribe from this group, send email to
hobousers+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.