I have a self-rolled authorization system base on RC#386. I noticed a lot of duplication between the GuestPermission class and the MemberPermision class.
class GuestPremission < BasePermission
allow_action :static, [:about, :careers, :contact, :help, :home]
end
and
class MemberPermission < BasePermission
allow_action :static, [:about, :careers, :contact, :help, :home]
end
Both inherit from BasePermission. I want to refactor the MemberPermission class to inherit from GuestPermission instead, like this:
class GuestPermission < BasePermission
allow_action :static, [:about, :careers, :contact, :help, :home]
end
class MemberPermission < GuestPermission
...
end
Ideally, this should reduce the duplication in MemberPermission that already is granted to and exists in GuestPermission. However, I get a recursive error: filter chain haled as :authorize rendered or redirected.
This usually tells me that the requested controller#action, (in this case static#home) hasn't been implicitly authorized. But in this case, it should be inheriting from GuestPermission.
Any ideas on fixing this so that the duplication of permissions isn't necessary?
Aucun commentaire:
Enregistrer un commentaire