Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/cevi 82 button visibilities #101

Merged
merged 2 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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