diff --git a/app/domain/pbs/table_displays/people/layer_group_label_column.rb b/app/domain/pbs/table_displays/people/layer_group_label_column.rb new file mode 100644 index 000000000..1629732de --- /dev/null +++ b/app/domain/pbs/table_displays/people/layer_group_label_column.rb @@ -0,0 +1,15 @@ +# Copyright (c) 2023, Pfadibewegung Schweiz. This file is part of +# hitobito_pbs and licensed under the Affero General Public License version 3 +# or later. See the COPYING file at the top-level directory or at +# https://github.com/hitobito/hitobito_pbs. + +module Pbs::TableDisplays::People + module LayerGroupLabelColumn + protected + + def allowed?(object, attr, original_object, original_attr) + # In events, evaluate the permission on the participation, not on the person + ability.can? required_permission(attr), original_object + end + end +end diff --git a/lib/hitobito_pbs/wagon.rb b/lib/hitobito_pbs/wagon.rb index 1582bd619..9bba14b1e 100644 --- a/lib/hitobito_pbs/wagon.rb +++ b/lib/hitobito_pbs/wagon.rb @@ -74,6 +74,10 @@ class Wagon < Rails::Engine Salutation.prepend Pbs::Salutation + TableDisplays::People::LayerGroupLabelColumn.prepend( + Pbs::TableDisplays::People::LayerGroupLabelColumn + ) + ### abilities Ability.store.register Event::ApprovalAbility AbilityDsl::UserContext::GROUP_PERMISSIONS << :crisis_trigger