Skip to content

Commit

Permalink
Merge pull request #101 from hitobito/feature/cevi_82_button_visibili…
Browse files Browse the repository at this point in the history
…ties

Feature/cevi 82 button visibilities
  • Loading branch information
kronn authored Feb 17, 2023
2 parents 459cf47 + f62dfb6 commit 90b1f78
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/abilities/cevi/event/application_ability.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

# Copyright (c) 2023, CEVI Regionalverband ZH-SH-GL. This file is part of
# hitobito_cevi 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_cevi.

module Cevi::Event::ApplicationAbility
extend ActiveSupport::Concern

included do
on(Event::Application) do
permission(:any).may(:approve).if_manage_attendances_in_event
end
end

def if_manage_attendances_in_event
permission_in_event?(:manage_attendances)
end

end
8 changes: 8 additions & 0 deletions app/abilities/cevi/event/participation_ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ module Cevi::Event::ParticipationAbility
permission(:layer_and_below_read).
may(:show).
in_same_layer_or_below_if_ausbildungsmitglied

permission(:any).
may(:create).
if_manage_attendances_in_event_or_her_own_if_application_possible
end
end

def if_manage_attendances_in_event_or_her_own_if_application_possible
permission_in_event?(:manage_attendances) || her_own_if_application_possible
end

def person_in_same_layer_or_below
person.nil? || permission_in_layers?(person.groups_hierarchy_ids)
end
Expand Down
1 change: 1 addition & 0 deletions lib/hitobito_cevi/wagon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Wagon < Rails::Engine
RoleAbility.include Cevi::RoleAbility
VariousAbility.include Cevi::VariousAbility
Event::ParticipationAbility.include Cevi::Event::ParticipationAbility
Event::ApplicationAbility.include Cevi::Event::ApplicationAbility
PersonReadables.include Cevi::PersonReadables
PersonLayerWritables.include Cevi::PersonLayerWritables
AbilityDsl::Base.include Cevi::AbilityDsl::Base
Expand Down

0 comments on commit 90b1f78

Please sign in to comment.