Skip to content
Snippets Groups Projects
Commit 4c690b1c authored by Robert Anderson's avatar Robert Anderson
Browse files

Only cap users after showing logs for both traffic and uptime now

parent df887758
No related branches found
No related tags found
No related merge requests found
...@@ -183,15 +183,6 @@ sub post_auth_hook ...@@ -183,15 +183,6 @@ sub post_auth_hook
"Min (Cap: Uncapped, Topups: ".$uptimeTopup."Min)"); "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 # Get topups
my $trafficTopup = 0; my $trafficTopup = 0;
if (defined($user->{'ConfigAttributes'}->{$TRAFFIC_TOPUPS_KEY})) { if (defined($user->{'ConfigAttributes'}->{$TRAFFIC_TOPUPS_KEY})) {
...@@ -249,6 +240,15 @@ sub post_auth_hook ...@@ -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; return MOD_RES_ACK;
} }
...@@ -376,15 +376,6 @@ sub post_acct_hook ...@@ -376,15 +376,6 @@ sub post_acct_hook
"Min (Cap: Uncapped, Topups: ".$uptimeTopup."Min)"); "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 # Get topups
my $trafficTopup = 0; my $trafficTopup = 0;
if (defined($user->{'ConfigAttributes'}->{$TRAFFIC_TOPUPS_KEY})) { if (defined($user->{'ConfigAttributes'}->{$TRAFFIC_TOPUPS_KEY})) {
...@@ -442,6 +433,15 @@ sub post_acct_hook ...@@ -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; return MOD_RES_ACK;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment