Open
Description
Descriptive summary
When Hydra::Ability
is included in a class, it overrides all existing ability_logic
entries (at https://github.com/samvera/hydra-head/blob/master/hydra-access-controls/lib/hydra/ability.rb#L16). avoid this.
Rationale
Overriding existing ability logic entries silently removes important permissions behavior in the application. This unexpected behavior can occur for reasons as simple as including this module in the "wrong" order.
Expected behavior
class Ability
self.ability_logic = [:my_custom_ability_hook, :other_ability_hook]
include Hydra::Ability
end
Ability.ability_logic.include?(:my_custom_ability_hook) # => true
Actual behavior
Ability.ability_logic.include?(:my_custom_ability_hook) # => false
Steps to reproduce the behavior
the easiest way to realistically reproduce is to do something like
class Ability
include Blacklight::AccessControls::Ability
self.ability_logic = [:my_custom_ability_hook]
# more logic here
# ...
# and so on
include Hydra::Ability
end
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog