app/models/concerns/hydra/access_controls/permissions.rb in hydra-access-controls-9.8.1 vs app/models/concerns/hydra/access_controls/permissions.rb in hydra-access-controls-9.9.0

- old
+ new

@@ -7,10 +7,18 @@ included do has_many :permissions, predicate: ::ACL.accessTo, class_name: 'Hydra::AccessControls::Permission', inverse_of: :access_to accepts_nested_attributes_for :permissions, allow_destroy: true alias_method :permissions_attributes_without_uniqueness=, :permissions_attributes= alias_method :permissions_attributes=, :permissions_attributes_with_uniqueness= + + before_destroy :remove_permissions end + + # Destroy and permission objects associated with this object + def remove_permissions + permissions.destroy_all + end + def to_solr(solr_doc = {}) super.tap do |doc| [:discover, :read, :edit].each do |access| vals = send("#{access}_groups")