config options supporters can promote

This commit is contained in:
Xu 2024-01-19 19:50:06 +01:00 committed by Igor Scheller
parent 496d75b9ef
commit 76c37a5f18
3 changed files with 6 additions and 3 deletions

View File

@ -262,6 +262,9 @@ return [
// Whether newly-registered user should automatically be marked as arrived
'autoarrive' => (bool) env('ANGEL_AUTOARRIVE', false),
// Supporters of an angeltype can promote other angels of the angeltype to supporter
'supporters_can_promote' => (bool) env('SUPPORTERS_CAN_PROMOTE', false),
// Only allow shift signup this number of hours in advance
// Setting this to 0 disables the feature
'signup_advance_hours' => env('SIGNUP_ADVANCE_HOURS', 0),

View File

@ -265,7 +265,7 @@ function user_angeltype_update_controller(): array
$supporter = false;
$request = request();
if (!auth()->can('admin_angel_types')) {
if (!auth()->can('admin_angel_types') && !config('supporters_can_promote')) {
error(__('You are not allowed to set supporter rights.'));
throw_redirect(url('/angeltypes'));
}

View File

@ -321,7 +321,7 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
]);
$members_unconfirmed[] = $member;
} elseif ($member->pivot->supporter) {
if ($admin_angeltypes) {
if ($admin_angeltypes || ($admin_user_angeltypes && config('supporters_can_promote'))) {
$member['actions'] = table_buttons([
button(
url('/user-angeltypes', [
@ -342,7 +342,7 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
} else {
if ($admin_user_angeltypes) {
$member['actions'] = table_buttons([
$admin_angeltypes ?
($admin_angeltypes || config('supporters_can_promote')) ?
button(
url('/user-angeltypes', [
'action' => 'update',