Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

feat(Product Adoption): add user consent option to send plain or anonymised platform informations. #10094

Merged
merged 22 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cron/centAcl.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@
}
$pearDB->commit();
$res1->closeCursor();

} catch (\PDOException $e) {
$pearDB->rollBack();
$centreonLog->insertLog(
Expand Down
8 changes: 8 additions & 0 deletions lang/fr_FR.UTF-8/LC_MESSAGES/help.po
Original file line number Diff line number Diff line change
Expand Up @@ -7231,3 +7231,11 @@ msgstr "URL complète permettant d'accéder à l'API du serveur central Centreon

msgid "Allows to skip the SSL certificate check on the Centreon's central server."
msgstr "Permet de ne pas vérifier le certificat SSL du serveur central Centreon."

msgid ""
"No: You don't consent to share your platform data. Contact Details: You consent to share your platform data including"
"your alias and email. Anonymized: You consent to share your platform data, but your alias and email will be anonymized."
msgstr ""
"Non: Vous ne consentez pas à partager les informations de votre plateforme. Détails du Contact: Vous consentez"
"à partager les informations de votre plateforme, y compris votre alias et email. Anonymisé: Vous consentez à partager"
"les informations de votre plateforme, mais votre alias et votre email seront anonymisés."
3 changes: 3 additions & 0 deletions lang/fr_FR.UTF-8/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -16226,5 +16226,8 @@ msgstr "Options de recherche"
msgid "The parameter \"%s\" must be an integer"
msgstr "Le paramètre \"%s\" doit être un entier"

msgid "Contact Details"
msgstr "Détails du Contact"

msgid "Service graphs"
msgstr "Graphiques de services"
8 changes: 7 additions & 1 deletion www/include/Administration/myAccount/DB-Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ function updateContact($contact_id = null)
'default_page = :defaultPage, ' .
'contact_js_effects = :contactJsEffects, ' .
'show_deprecated_pages = :showDeprecatedPages, ' .
'contact_autologin_key = :contactAutologinKey';
'contact_autologin_key = :contactAutologinKey, ' .
'contact_platform_data_sending = :contactDataSending';
$password_encrypted = null;
if (!empty($ret['contact_passwd'])) {
$rq .= ', contact_passwd = :contactPasswd';
Expand Down Expand Up @@ -181,6 +182,11 @@ function updateContact($contact_id = null)
!empty($ret['contact_location']) ? $ret['contact_location'] : null,
\PDO::PARAM_INT
);
$stmt->bindValue(
':contactDataSending',
array_key_exists('contact_platform_data_sending', $ret) ? $ret['contact_platform_data_sending'] : null,
\PDO::PARAM_STR
);
$stmt->bindValue(':defaultPage', !empty($ret['default_page']) ? $ret['default_page'] : null, \PDO::PARAM_INT);
$stmt->bindValue(':contactJsEffects', isset($ret['contact_js_effects']) ? 1 : 0, \PDO::PARAM_STR);
$stmt->bindValue(':showDeprecatedPages', isset($ret['show_deprecated_pages']) ? 1 : 0, \PDO::PARAM_STR);
Expand Down
1 change: 1 addition & 0 deletions www/include/Administration/myAccount/formMyAccount.ihtml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<tr class="list_two"><td class="FormRowField">{$form.default_page.label}</td><td class="FormRowValue">{$form.default_page.html}</td></tr>
<tr class="list_one"><td class="FormRowField">{$form.show_deprecated_pages.label}</td><td class="FormRowValue">{$form.show_deprecated_pages.html}</td></tr>
<tr class="list_two"><td class="FormRowField">{$form.contact_js_effects.label}</td><td class="FormRowValue">{$form.contact_js_effects.html}</td></tr>
<tr class="list_one"><td class="FormRowField"><img class="helpTooltip" name="contact_platform_data_sending">{$form.contact_platform_data_sending.label}</td><td class="FormRowValue">{$form.contact_platform_data_sending.html}</td></tr>
<tr class="list_lvl_1">
<td class="ListColLvl1_name" colspan="2">
<h4>{t}Authentication{/t}</h4>
Expand Down
28 changes: 26 additions & 2 deletions www/include/Administration/myAccount/formMyAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,21 @@
$centreonFeature = new CentreonFeature($pearDB);
}

try {
$licenseObject = $dependencyInjector['lm.license'];
$isLicenseValid = $licenseObject->validate(true);
} catch (\Exception $ex) {
$isLicenseValid = false;
}

/*
* Database retrieve information for the User
*/
$cct = array();
if ($o == "c") {
$query = "SELECT contact_id, contact_name, contact_alias, contact_lang, contact_email, contact_pager,
contact_js_effects, contact_autologin_key, default_page, show_deprecated_pages, contact_auth_type
contact_js_effects, contact_autologin_key, default_page, show_deprecated_pages, contact_auth_type,
contact_platform_data_sending
FROM contact WHERE contact_id = :id";
$DBRESULT = $pearDB->prepare($query);
$DBRESULT->bindValue(':id', $centreon->user->get_id(), \PDO::PARAM_INT);
Expand Down Expand Up @@ -138,8 +146,24 @@
$form->addElement('checkbox', 'show_deprecated_pages', _("Show deprecated pages"), null, $attrsText);
$form->addElement('checkbox', 'contact_js_effects', _("Animation effects"), null, $attrsText);

$platformDataSendingRadios = [
$form->createElement('radio', null, null, _('No'), '0'),
$form->createElement('radio', null, null, _('Contact Details'), '1'),
$form->createElement('radio', null, null, _('Anonymized'), '2')
];

if ($isLicenseValid) {
unset($platformDataSendingRadios[0]);
}

$form->addGroup(
$platformDataSendingRadios,
'contact_platform_data_sending',
_('Contextual assistance and associated data sending'),
'&nbsp;'
);

/* ------------------------ Topoogy ---------------------------- */
/* ------------------------ Topology ---------------------------- */
$pages = [];
$aclUser = $centreon->user->lcaTStr;
if (!empty($aclUser)) {
Expand Down
7 changes: 7 additions & 0 deletions www/include/configuration/configObject/contact/DB-Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,13 @@ function sanitizeFormContactParameters(array $ret): array
: '2'
];
break;
case 'contact_platform_data_sending':
$bindParams[':' . $inputName] = [
\PDO::PARAM_STR => in_array($inputValue[$inputName], ['0', '1', '2'])
? $inputValue[$inputName]
: '0'
];
break;
case 'contact_admin':
$bindParams[':' . $inputName] = [
\PDO::PARAM_STR => in_array($inputValue[$inputName], ['0', '1'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@
</td>
</tr>
<tr class="list_one"><td class="FormRowField">{$form.contact_activate.label}</td><td class="FormRowValue">{$form.contact_activate.html}</td></tr>
<tr class="list_two"><td class="FormRowField">{$form.contact_comment.label}</td><td class="FormRowValue">{$form.contact_comment.html}</td></tr>
<tr class="list_two"><td class="FormRowField"><img class="helpTooltip" name="contact_platform_data_sending">{$form.contact_platform_data_sending.label}</td><td class="FormRowValue">{$form.contact_platform_data_sending.html}</td></tr>
<tr class="list_one"><td class="FormRowField">{$form.contact_comment.label}</td><td class="FormRowValue">{$form.contact_comment.html}</td></tr>
{if $o == "a" || $o == "c"}
<tr class="list_lvl_2"><td class="ListColLvl2_name" colspan="2">{$form.required._note}</td></tr>
{/if}
Expand Down
Loading