Commit c1a409d5 authored by Avris's avatar Avris

allow re-deploy by the same user

parent f5254b65
......@@ -41,13 +41,14 @@ class ServerController extends BaseApiController
{
$server = $this->project->getServer($serverName);
if ($server->getCurrentStatus()->isTaken()) {
$projectUser = $this->getProjectUser();
$user = $projectUser ? $projectUser->getUser() : null;
if ($server->getCurrentStatus()->isTaken() && $server->getCurrentStatus()->getUser() !== $user) {
throw new BadRequestException('Server is already taken');
}
$projectUser = $this->getProjectUser();
$update = new ServerUpdate($server, $projectUser ? $projectUser->getUser() : null);
$update = new ServerUpdate($server, $user);
$update->setBranch((string) BagHelper::magicGetter($this->getRequest()->getJsonBody(), 'branch'));
$update->setAutoRelease($this->buildAutoRelease(
BagHelper::magicGetter($this->getRequest()->getJsonBody(), ('autoRelease')
......@@ -74,11 +75,11 @@ class ServerController extends BaseApiController
}
$value = new DateTime($value);
if ($value < new DateTime('+ 10 minutes')) {
if ($value < new DateTime('+10 minutes')) {
throw new BadRequestException(l('entity.ServerUpdate.autoRelease.error.MinDate'));
}
if ($value > new DateTime('+ 7 days')) {
if ($value > new DateTime('+7 days')) {
throw new BadRequestException(l('entity.ServerUpdate.autoRelease.error.MaxDate'));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment