Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fallback option to punctually check abilities without inheriting …
…from manageds Refs hitobito/hitobito#1967
- Loading branch information
1 parent
a41015e
commit 299684f
Showing
2 changed files
with
22 additions
and
1 deletion.
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,20 @@ | ||
# frozen_string_literal: true | ||
|
||
# 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. | ||
|
||
# Most of the time, managers inherit a fixed list of abilities from their manageds. | ||
# But sometimes, we need to check whether the manager would be allowed something | ||
# even if they weren't a manager. In the youth wagon, we override the default | ||
# ability class to take the inherited abilities into account. This ability class here | ||
# allows us to revert back to the core behaviour in the few places where we need it. | ||
class AbilityWithoutManagerAbilities < Ability | ||
|
||
private | ||
|
||
def define_user_abilities(current_store, current_user_context) | ||
super(current_store, current_user_context, false) | ||
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