MT#3933 API: Check for max_subscribers on create

agranig/auth-refactoring
Andreas Granig 11 years ago
parent aa5eee69a0
commit ce01267079

@ -216,6 +216,13 @@ sub POST :Allow {
$self->error($c, HTTP_UNPROCESSABLE_ENTITY, "Invalid 'customer_id', doesn't exist.");
last;
}
if(defined $customer->max_subscribers && $customer->voip_subscribers->search({
status => { '!=' => 'terminated' }
})->count >= $customer->max_subscribers) {
$self->error($c, HTTP_FORBIDDEN, "Maximum number of subscribers reached.");
last;
}
# TODO: check if number is already taken

Loading…
Cancel
Save