diff --git a/smradius/modules/features/mod_feature_capping.pm b/smradius/modules/features/mod_feature_capping.pm index 172327808e5eb268a790b39445dd7215ee283be0..c4dee12c69cea6eaf23c8083529bd417ad6d8eea 100644 --- a/smradius/modules/features/mod_feature_capping.pm +++ b/smradius/modules/features/mod_feature_capping.pm @@ -183,15 +183,6 @@ sub post_auth_hook "Min (Cap: Uncapped, Topups: ".$uptimeTopup."Min)"); } - # If uptime limit exceeded, cap user - if (!(defined($uptimeLimit->{':='}->{'Value'}) && $uptimeLimit->{':='}->{'Value'} == 0)) { - if ($accountingUsage->{'TotalTimeUsage'} >= $alteredUptimeLimit) { - $server->log(LOG_DEBUG,"[MOD_FEATURE_CAPPING] Usage of ".$accountingUsage->{'TotalTimeUsage'}. - "Min exceeds allowed limit of ".$alteredUptimeLimit."Min. Capped."); - return MOD_RES_NACK; - } - } - # Get topups my $trafficTopup = 0; if (defined($user->{'ConfigAttributes'}->{$TRAFFIC_TOPUPS_KEY})) { @@ -249,6 +240,15 @@ sub post_auth_hook } } + # If uptime limit exceeded, cap user + if (!(defined($uptimeLimit->{':='}->{'Value'}) && $uptimeLimit->{':='}->{'Value'} == 0)) { + if ($accountingUsage->{'TotalTimeUsage'} >= $alteredUptimeLimit) { + $server->log(LOG_DEBUG,"[MOD_FEATURE_CAPPING] Usage of ".$accountingUsage->{'TotalTimeUsage'}. + "Min exceeds allowed limit of ".$alteredUptimeLimit."Min. Capped."); + return MOD_RES_NACK; + } + } + return MOD_RES_ACK; } @@ -376,15 +376,6 @@ sub post_acct_hook "Min (Cap: Uncapped, Topups: ".$uptimeTopup."Min)"); } - # If uptime limit exceeded, cap user - if (!(defined($uptimeLimit->{':='}->{'Value'}) && $uptimeLimit->{':='}->{'Value'} == 0)) { - if ($accountingUsage->{'TotalTimeUsage'} >= $alteredUptimeLimit) { - $server->log(LOG_DEBUG,"[MOD_FEATURE_CAPPING] Usage of ".$accountingUsage->{'TotalTimeUsage'}. - "Min exceeds allowed limit of ".$alteredUptimeLimit."Min. Capped."); - return MOD_RES_NACK; - } - } - # Get topups my $trafficTopup = 0; if (defined($user->{'ConfigAttributes'}->{$TRAFFIC_TOPUPS_KEY})) { @@ -442,6 +433,15 @@ sub post_acct_hook } } + # If uptime limit exceeded, cap user + if (!(defined($uptimeLimit->{':='}->{'Value'}) && $uptimeLimit->{':='}->{'Value'} == 0)) { + if ($accountingUsage->{'TotalTimeUsage'} >= $alteredUptimeLimit) { + $server->log(LOG_DEBUG,"[MOD_FEATURE_CAPPING] Usage of ".$accountingUsage->{'TotalTimeUsage'}. + "Min exceeds allowed limit of ".$alteredUptimeLimit."Min. Capped."); + return MOD_RES_NACK; + } + } + return MOD_RES_ACK; }