From 69b422e3f58f17fa59cc320eb130d20acd555940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Zl=C3=A1mal?= Date: Mon, 12 Jun 2023 20:49:01 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20extend=20grace=20period=20for=20students?= =?UTF-8?q?=20in=20V=C5=A0UP=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gen/ad_group_vsup_o365 | 4 ++-- gen/ad_user_vsup | 6 +++--- gen/vsup_google_groups | 5 +++-- gen/vsup_k4 | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gen/ad_group_vsup_o365 b/gen/ad_group_vsup_o365 index d7a2d394..34f8de98 100755 --- a/gen/ad_group_vsup_o365 +++ b/gen/ad_group_vsup_o365 @@ -123,7 +123,7 @@ perunServicesInit::finalize; # -# returns 1 if the the latest of given expiration is either in the future, or in the 21 days grace period +# returns 1 if the the latest of given expiration is either in the future, or in the 28 days grace period # otherwise, returns 0 # sub isActive() { @@ -156,7 +156,7 @@ sub isActive() { # Add time 23:59:59 to the date, since we want accounts to be active on the last day $latest_expiration = $latest_expiration + 86399; - if (($latest_expiration + (21*24*60*60)) > $currentDate->epoch) { + if (($latest_expiration + (28*24*60*60)) > $currentDate->epoch) { return 1; } diff --git a/gen/ad_user_vsup b/gen/ad_user_vsup index 81b4ba90..b84024ab 100755 --- a/gen/ad_user_vsup +++ b/gen/ad_user_vsup @@ -250,7 +250,7 @@ perunServicesInit::finalize; # Returns Windows FILETIME timestamp of users account expiration # - in case of expiration on 1.1.4000 -> Zero is returned as "expiration = never". # - in case of any other exact date, pick the largest (future). If it comes from study system (KOS), -# add 21 days grace period. +# add 28 days grace period. # sub calculateExpiration() { @@ -285,9 +285,9 @@ sub calculateExpiration() { return 0; } - # (will) expire by studies - add 21 days grace period + # (will) expire by studies - add 28 days grace period if ($expirationKosTime and ($latest_expiration == $expirationKosTime->epoch)) { - $result = $latest_expiration + (21*24*60*60); + $result = $latest_expiration + (28*24*60*60); } else { # Expired by employment or manual - push exact date $result = $latest_expiration; diff --git a/gen/vsup_google_groups b/gen/vsup_google_groups index ec849d82..364bd135 100755 --- a/gen/vsup_google_groups +++ b/gen/vsup_google_groups @@ -123,7 +123,7 @@ perunServicesInit::finalize; # # Calculate if user is expired or not. # -# 1. param - expiration in KOS (studies) +# 1. param - expiration in KOS (studies) (we will add 28 days grace period to the calculation) # 2. param - expiration in DC2 (employees) # 3. param - manually set expiration # @@ -140,8 +140,9 @@ sub isExpired() { my $expirationDc2Time = ($expirationDc2) ? Time::Piece->strptime($expirationDc2,"%Y-%m-%d") : undef; my $expirationManTime = ($expirationMan) ? Time::Piece->strptime($expirationMan,"%Y-%m-%d") : undef; + # Extend KOS studies expiration with 28 days if there is a defined value my @expirations = (); - if (defined $expirationKosTime) { push(@expirations, $expirationKosTime->epoch); } + if (defined $expirationKosTime) { push(@expirations, ($expirationKosTime->epoch + (28*24*60*60))); } if (defined $expirationDc2Time) { push(@expirations, $expirationDc2Time->epoch); } if (defined $expirationManTime) { push(@expirations, $expirationManTime->epoch); } diff --git a/gen/vsup_k4 b/gen/vsup_k4 index 2f81aa29..e530eeb1 100755 --- a/gen/vsup_k4 +++ b/gen/vsup_k4 @@ -195,7 +195,7 @@ perunServicesInit::finalize; # Returns Unix timestamp of users account expiration # - in case of expiration on 1.1.4000 -> Zero is returned as "expiration = never". # - in case of any other exact date, pick the largest (future). If it comes from study system (KOS), -# add 21 days grace period. +# add 28 days grace period. # sub calculateExpiration() { @@ -230,9 +230,9 @@ sub calculateExpiration() { return 0; } - # (will) expire by studies - add 21 days grace period + # (will) expire by studies - add 28 days grace period if ($expirationKosTime and ($latest_expiration == $expirationKosTime->epoch)) { - $result = $latest_expiration + (21*24*60*60); + $result = $latest_expiration + (28*24*60*60); } else { # Expired by employment or manual - push exact date $result = $latest_expiration;