stffn/declarative_authorization — Issue #128: :context=>:foo does not set specified context in nested controller?
Author: zachris
Created: 2012-02-01 12:51:51+00:00
State: open

I'm trying to override context in a nested controller
I have similar controllers nested under different namespaces but want to manage only one kind of permission for all.

I have a roles with permissions like this.
has_permission_on :foo, :to=>:manage

And a controller that might look like this:

class Bars::FooController

#this does not work, it denies permissions for context => :bars_foo
filter_access_to :new, :create, :require =>:manage, :context=>:foo

#but this DOES work!?
filter_access_to :index, :require =>:read, :context=>:foo

#Explicitly overriding decl_auth_context works however...
class << self
def decl_auth_context
:foo
end
end

[...]

end

Something strange is going on. It works for :read, but not for :new (falling back to default). I can't see the logic behind it...