Re-add object-level auth to Spree::Admin::ResourceController

This commit is contained in:
Rohan Mitchell
2016-05-20 16:26:54 +10:00
parent 1497d2c3bb
commit 257441c9be

View File

@@ -0,0 +1,16 @@
module AuthorizeOnLoadResource
def load_resource
super
if member_action?
# If we don't have access, clear the object
unless can? action, @object
instance_variable_set("@#{object_name}", nil)
end
authorize! action, @object
end
end
end
Spree::Admin::ResourceController.send(:prepend, AuthorizeOnLoadResource)