diff --git a/CHANGELOG.md b/CHANGELOG.md index a3098114c..2ef224da0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactor server health, making it more robust against temporary connection issues ([#911]) - Calculation of server load uses the participants amount, during starting phase using a configurable min. amount ([#956]) - Layout of room features tab view ([#967]) +- **Breaking:** Time periods for room token expiration ([#968]) ### Fixed - Issue frontend recompiled on every restart due to a hashing issue ([#792]) @@ -87,6 +88,7 @@ You can find the changelog for older versions there [here](https://github.com/TH [#927]: https://github.com/THM-Health/PILOS/pull/927 [#956]: https://github.com/THM-Health/PILOS/pull/956 [#967]: https://github.com/THM-Health/PILOS/pull/967 +[#968]: https://github.com/THM-Health/PILOS/pull/968 [unreleased]: https://github.com/THM-Health/PILOS/compare/v3.0.2...develop [v3.0.0]: https://github.com/THM-Health/PILOS/releases/tag/v3.0.0 diff --git a/app/Console/Commands/CleanupAttendanceCommand.php b/app/Console/Commands/CleanupAttendanceCommand.php index 4f931d7f4..b1ac338c1 100644 --- a/app/Console/Commands/CleanupAttendanceCommand.php +++ b/app/Console/Commands/CleanupAttendanceCommand.php @@ -30,8 +30,10 @@ class CleanupAttendanceCommand extends Command public function handle() { // Remove all attendance data older than the retention period - $day = now()->subDays(setting('attendance.retention_period'))->toDateString(); - Log::info('Removing attendance data older than '.$day); - MeetingAttendee::where('join', '<', $day)->delete(); + if (setting('attendance.retention_period') != -1) { + $day = now()->subDays(setting('attendance.retention_period'))->toDateString(); + Log::info('Removing attendance data older than '.$day); + MeetingAttendee::where('join', '<', $day)->delete(); + } } } diff --git a/app/Console/Commands/CleanupStatisticsCommand.php b/app/Console/Commands/CleanupStatisticsCommand.php index 6bb14165a..b1a3ec10f 100644 --- a/app/Console/Commands/CleanupStatisticsCommand.php +++ b/app/Console/Commands/CleanupStatisticsCommand.php @@ -31,13 +31,17 @@ class CleanupStatisticsCommand extends Command public function handle() { // Remove all server statistics data older than the retention period - $serverDay = now()->subDays(setting('statistics.servers.retention_period'))->toDateString(); - Log::info('Removing server statistics data older than '.$serverDay); - ServerStat::where('created_at', '<', $serverDay)->delete(); + if (setting('statistics.servers.retention_period') != -1) { + $serverDay = now()->subDays(setting('statistics.servers.retention_period'))->toDateString(); + Log::info('Removing server statistics data older than '.$serverDay); + ServerStat::where('created_at', '<', $serverDay)->delete(); + } // Remove all meeting statistics data older than the retention period - $meetingDay = now()->subDays(setting('statistics.meetings.retention_period'))->toDateString(); - Log::info('Removing meeting statistics data older than '.$serverDay); - MeetingStat::where('created_at', '<', $meetingDay)->delete(); + if (setting('statistics.meetings.retention_period') != -1) { + $meetingDay = now()->subDays(setting('statistics.meetings.retention_period'))->toDateString(); + Log::info('Removing meeting statistics data older than '.$serverDay); + MeetingStat::where('created_at', '<', $meetingDay)->delete(); + } } } diff --git a/app/Console/Commands/DeleteObsoleteTokensCommand.php b/app/Console/Commands/DeleteObsoleteTokensCommand.php index be5996d0e..521d59d87 100644 --- a/app/Console/Commands/DeleteObsoleteTokensCommand.php +++ b/app/Console/Commands/DeleteObsoleteTokensCommand.php @@ -33,11 +33,11 @@ public function handle() if (setting('room_token_expiration') > -1) { $expiredTokens = RoomToken::where(function ($query) { $query->whereNull('last_usage') - ->where('created_at', '<', Carbon::now()->subMinutes(setting('room_token_expiration'))); + ->where('created_at', '<', Carbon::now()->subDays(setting('room_token_expiration'))); }) ->orWhere(function ($query) { $query->whereNotNull('last_usage') - ->where('last_usage', '<', Carbon::now()->subMinutes(setting('room_token_expiration'))); + ->where('last_usage', '<', Carbon::now()->subDays(setting('room_token_expiration'))); }) ->pluck('token'); diff --git a/app/Enums/TimePeriod.php b/app/Enums/TimePeriod.php new file mode 100644 index 000000000..65dfc2756 --- /dev/null +++ b/app/Enums/TimePeriod.php @@ -0,0 +1,18 @@ + 'nullable|string|url|max:255', 'privacy_policy_url' => 'nullable|string|url|max:255', 'statistics.servers.enabled' => 'required|boolean', - 'statistics.servers.retention_period' => 'required|numeric|min:1|max:365', + 'statistics.servers.retention_period' => ['required', 'numeric', Rule::enum(TimePeriod::class)], 'statistics.meetings.enabled' => 'required|boolean', - 'statistics.meetings.retention_period' => 'required|numeric|min:1|max:365', - 'attendance.retention_period' => 'required|numeric|min:1|max:365', + 'statistics.meetings.retention_period' => ['required', 'numeric', Rule::enum(TimePeriod::class)], + 'attendance.retention_period' => ['required', 'numeric', Rule::enum(TimePeriod::class)], 'bbb.logo' => 'string|max:255', 'bbb.logo_file' => 'image|max:500', 'bbb.style' => 'nullable|file|max:500', - 'room_token_expiration' => 'required|numeric|in:,-1,1440,10080,43200,129600,262800,525600', + 'room_token_expiration' => ['required', 'numeric', Rule::enum(TimePeriod::class)], 'room_auto_delete.enabled' => 'required|boolean', - 'room_auto_delete.inactive_period' => 'required|numeric|in:-1,7,14,30,90,180,365,730', - 'room_auto_delete.never_used_period' => 'required|numeric|in:-1,7,14,30,90,180,365,730', - 'room_auto_delete.deadline_period' => 'required|numeric|in:7,14,30', + 'room_auto_delete.inactive_period' => ['required', 'numeric', Rule::enum(TimePeriod::class)], + 'room_auto_delete.never_used_period' => ['required', 'numeric', Rule::enum(TimePeriod::class)], + 'room_auto_delete.deadline_period' => ['required', 'numeric', Rule::enum(TimePeriod::class)->only([TimePeriod::ONE_WEEK, TimePeriod::TWO_WEEKS, TimePeriod::ONE_MONTH])], ]; } diff --git a/app/Models/RoomToken.php b/app/Models/RoomToken.php index a9482869b..ea2f8b5bf 100644 --- a/app/Models/RoomToken.php +++ b/app/Models/RoomToken.php @@ -87,6 +87,6 @@ public function getFullnameAttribute() */ public function getExpiresAttribute() { - return setting('room_token_expiration') > -1 ? ($this->last_usage != null ? $this->last_usage->addMinutes(setting('room_token_expiration')) : $this->created_at->addMinutes(setting('room_token_expiration'))) : null; + return setting('room_token_expiration') > -1 ? ($this->last_usage != null ? $this->last_usage->addDays(setting('room_token_expiration')) : $this->created_at->addDays(setting('room_token_expiration'))) : null; } } diff --git a/lang/de/meetings.php b/lang/de/meetings.php index ccd92eb47..3bb3fd801 100644 --- a/lang/de/meetings.php +++ b/lang/de/meetings.php @@ -11,6 +11,7 @@ 'no_data' => 'Keine protokollierte Anwesenheit gefunden.', 'no_data_filtered' => 'Für die Suchanfrage wurde keine protokollierte Anwesenheit gefunden!', 'retention_period' => 'Die Anwesenheit wird für :days Tage gespeichert.', + 'retention_period_unlimited' => 'Die Anwesenheit wird zeitlich unbegrenzt gespeichert.', 'sessions' => 'Sitzungen', 'view' => 'Anwesenheit anzeigen', ], @@ -31,6 +32,7 @@ 'no_breakout_support' => 'Die Auslastung der Breakout-Räume wird aktuell nicht unterstützt. Es wird nur die Auslastung des Hauptraums gemessen.', 'participants' => 'Teilnehmer', 'retention_period' => 'Die Auslastung der Räume wird für :days Tage gespeichert.', + 'retention_period_unlimited' => 'Die Auslastung der Räume wird zeitlich unbegrenzt gespeichert.', 'time' => 'Uhrzeit', 'videos' => 'Webcams', 'voices' => 'Mikrofone', diff --git a/lang/de/settings.php b/lang/de/settings.php index d56efdf34..e4f7c7a9f 100644 --- a/lang/de/settings.php +++ b/lang/de/settings.php @@ -12,6 +12,7 @@ 'banner_title' => 'Überschrift', 'color' => 'Textfarbe des Banners', 'enabled' => 'Anzeigen', + 'preview' => 'Vorschau', 'icon' => 'Icon', 'icon_description' => 'Die CSS-Klasse des Fontawesome-Icons (z. B. `fa-solid fa-door-open`). Das Icon wird nur angezeigt, wenn ein Titel angegeben wurde.', 'link' => 'Anzuzeigender Link nach der Mitteilung', diff --git a/lang/en/meetings.php b/lang/en/meetings.php index ade6e3404..891ef101c 100644 --- a/lang/en/meetings.php +++ b/lang/en/meetings.php @@ -11,6 +11,7 @@ 'no_data' => 'No logged attendance found.', 'no_data_filtered' => 'For the filter query no logged attendance were found!', 'retention_period' => 'The attendance is stored for :days days.', + 'retention_period_unlimited' => 'The attendance is stored indefinitely.', 'sessions' => 'Sessions', 'view' => 'Show attendance', ], @@ -31,6 +32,7 @@ 'no_breakout_support' => 'The utilisation of the breakout rooms is currently not supported. Only the utilisation of the main room is measured.', 'participants' => 'Participants', 'retention_period' => 'The utilisation of the rooms is stored for :days days.', + 'retention_period_unlimited' => 'The utilisation of the rooms is stored indefinitely.', 'time' => 'Time', 'videos' => 'Webcams', 'voices' => 'Microphones', diff --git a/lang/en/settings.php b/lang/en/settings.php index d01966d6d..93a458117 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -12,6 +12,7 @@ 'banner_title' => 'Title', 'color' => 'Text color of the banner', 'enabled' => 'Show', + 'preview' => 'Preview', 'icon' => 'Icon', 'icon_description' => 'The CSS class of the Fontawesome-Icon (e. g. `fa-solid fa-door-open`). The icon will only be visible, if a title is supplied.', 'link' => 'Link to show after the message', diff --git a/resources/js/components/RoomTabHistory.vue b/resources/js/components/RoomTabHistory.vue index 5aec8834a..203bd2f11 100644 --- a/resources/js/components/RoomTabHistory.vue +++ b/resources/js/components/RoomTabHistory.vue @@ -79,8 +79,11 @@ > {{ $t('meetings.retention_period') }}
- {{ $t('meetings.stats.retention_period', {'days': settingsStore.getSetting('statistics.meetings.retention_period')}) }}
- {{ $t('meetings.attendance.retention_period', {'days': settingsStore.getSetting('attendance.retention_period')}) }}
+ {{ $t('meetings.stats.retention_period', {'days': settingsStore.getSetting('statistics.meetings.retention_period')}) }}
+ {{ $t('meetings.stats.retention_period_unlimited') }}
+ + {{ $t('meetings.attendance.retention_period', {'days': settingsStore.getSetting('attendance.retention_period')}) }}
+ {{ $t('meetings.attendance.retention_period_unlimited') }}
diff --git a/resources/js/views/settings/Config.vue b/resources/js/views/settings/Config.vue index 03a752d20..82f85f891 100644 --- a/resources/js/views/settings/Config.vue +++ b/resources/js/views/settings/Config.vue @@ -178,8 +178,11 @@ + +

{{ $t('settings.application.banner.title') }}

+
- {{$t('settings.application.banner.title')}} + {{$t('settings.application.banner.enabled')}}
- +

+
+
-
- +
+ {{$t('settings.application.banner.preview')}} +
+ +
+
- - -
- -
-
-
+
+ +
+
+
-
- -
-
-
+
+ +
+
+
-
- -
-