Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow managers to create and manage event participations of their man…
…ageds Most of the changes here can use the new for_self_or_manageds mechanism. But when a condition combines her_own_or_something_else, then we must manually add the manager option, to make sure that the manager only inherits the her_own part, not the something_else part. Refs hitobito/hitobito#1967
- Loading branch information
1 parent
299684f
commit 1d5fb9a
Showing
5 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# encoding: utf-8 | ||
|
||
# Copyright (c) 2023, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_youth 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_youth. | ||
|
||
module Youth::Event::ApplicationAbility | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
on(Event::Application) do | ||
for_self_or_manageds do | ||
# abilities which managers inherit from their managed children | ||
permission(:any).may(:show_priorities, :show_approval).her_own | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# encoding: utf-8 | ||
|
||
# Copyright (c) 2023, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_youth 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_youth. | ||
|
||
module Youth::Event::InvitationAbility | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
on(Event::Invitation) do | ||
for_self_or_manageds do | ||
# abilities which managers inherit from their managed children | ||
permission(:any).may(:decline).own_invitation | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/abilities/youth/event/participation_contact_data_ability.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# encoding: utf-8 | ||
|
||
# Copyright (c) 2023, Pfadibewegung Schweiz. This file is part of | ||
# hitobito_youth 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_youth. | ||
|
||
module Youth::Event::ParticipationContactDataAbility | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
on(Event::ParticipationContactData) do | ||
for_self_or_manageds do | ||
# abilities which managers inherit from their managed children | ||
permission(:any).may(:show, :update).her_own | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters