diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php index 35c8f6303197a67f29bb72bf2e2c587027f3b8e9..fb1922631fca3e58e8345905d02813faaafdbf0f 100755 --- a/src/app/user/controllers/UserController.php +++ b/src/app/user/controllers/UserController.php @@ -149,7 +149,11 @@ class UserController $check = $check && Validator::stringType()->notEmpty()->validate($data['firstname']); $check = $check && Validator::stringType()->notEmpty()->validate($data['lastname']); $check = $check && (empty($data['mail']) || filter_var($data['mail'], FILTER_VALIDATE_EMAIL)); - $check = $check && (empty($data['phone']) || preg_match("/\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$/", $data['phone'])); + + if (PrivilegeController::hasPrivilege(['privilegeId' => 'manage_personal_data', 'userId' => $GLOBALS['id']])) { + $check = $check && (empty($data['phone']) || preg_match("/\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$/", $data['phone'])); + } + if (!$check) { return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); }