Add option to hide iCal/JSON export

2022-03-24
Luca 3 years ago
parent 15c677a28c
commit c8706d527e

@ -273,6 +273,9 @@ return [
// Enables the goody/voucher configuration on signup and profile // Enables the goody/voucher configuration on signup and profile
'enable_goody' => (bool)env('ENABLE_GOODY', false), 'enable_goody' => (bool)env('ENABLE_GOODY', false),
// Enables shifts export as iCal/JSON (if disabled, buttons/links will not be shown, but endpoints will still work)
'enable_shifts_export' => (bool)env('ENABLE_SHIFTS_EXPORT', false),
// Number of shifts to freeload until angel is locked for shift signup. // Number of shifts to freeload until angel is locked for shift signup.
'max_freeloadable_shifts' => env('MAX_FREELOADABLE_SHIFTS', 1), 'max_freeloadable_shifts' => env('MAX_FREELOADABLE_SHIFTS', 1),

@ -609,6 +609,7 @@ function User_view(
} }
} }
$enable_export = config('enable_shifts_export');
return page_with_title( return page_with_title(
'<span class="icon-icon_angel"></span> ' '<span class="icon-icon_angel"></span> '
. ( . (
@ -656,15 +657,15 @@ function User_view(
page_link_to('user_settings'), page_link_to('user_settings'),
icon('gear') . __('Settings') icon('gear') . __('Settings')
) : '', ) : '',
($its_me && $auth->can('ical')) ? button( ($its_me && $enable_export && $auth->can('ical')) ? button(
page_link_to('ical', ['key' => $user_source->api_key]), page_link_to('ical', ['key' => $user_source->api_key]),
icon('calendar3') . __('iCal Export') icon('calendar3') . __('iCal Export')
) : '', ) : '',
($its_me && $auth->can('shifts_json_export')) ? button( ($its_me && $enable_export && $auth->can('shifts_json_export')) ? button(
page_link_to('shifts_json_export', ['key' => $user_source->api_key]), page_link_to('shifts_json_export', ['key' => $user_source->api_key]),
icon('box-arrow-up-right') . __('JSON Export') icon('box-arrow-up-right') . __('JSON Export')
) : '', ) : '',
($its_me && ( ($its_me && $enable_export && (
$auth->can('shifts_json_export') $auth->can('shifts_json_export')
|| $auth->can('ical') || $auth->can('ical')
|| $auth->can('atom') || $auth->can('atom')
@ -703,7 +704,7 @@ function User_view(
page_link_to('user_shifts') page_link_to('user_shifts')
), true) ), true)
: '', : '',
$its_me ? ical_hint() : '' $its_me && $enable_export ? ical_hint() : ''
] ]
); );
} }

Loading…
Cancel
Save