Skip to content
Snippets Groups Projects
Verified Commit a86d96ff authored by Damien's avatar Damien
Browse files

FEAT #13339 TIME 0:25 Control email when webservice user

parent dcea06a2
No related branches found
No related tags found
No related merge requests found
......@@ -139,7 +139,15 @@ class ContactController
if (!empty($control['errors'])) {
return $response->withStatus(400)->withJson(['errors' => $control['errors']]);
}
$currentUser = UserModel::getById(['id' => $GLOBALS['id'], 'select' => ['loginmode']]);
if (!empty($body['email']) && $currentUser['loginmode'] == 'restMode') {
$contact = ContactModel::get(['select' => ['id'], 'where' => ['email = ?'], 'data' => [$body['email']]]);
if (!empty($contact[0]['id'])) {
return $response->withJson(['id' => $contact[0]['id']]);
}
}
if (!empty($body['communicationMeans'])) {
if (filter_var($body['communicationMeans'], FILTER_VALIDATE_EMAIL)) {
$body['communicationMeans'] = ['email' => $body['communicationMeans']];
......
......@@ -421,7 +421,6 @@ class IndexingModelController
'where' => ['model_id = ?'],
'data' => [$args['id']]
]);
if (!empty($resources)) {
return $response->withStatus(400)->withJson(['errors' => 'Model is used by at least one resource', 'lang' => 'modelUsedByResources']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment