Skip to content

Commit

Permalink
fix: extend grace period for students in VŠUP services
Browse files Browse the repository at this point in the history
  • Loading branch information
zlamalp committed Jun 13, 2023
1 parent 41b4eac commit 69b422e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions gen/ad_group_vsup_o365
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions gen/ad_user_vsup
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions gen/vsup_google_groups
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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); }

Expand Down
6 changes: 3 additions & 3 deletions gen/vsup_k4
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 69b422e

Please sign in to comment.