Skip to content

Commit

Permalink
Dev: CPDB attributes would be multi encrypted/decrypted when editing …
Browse files Browse the repository at this point in the history
…values or loading them
  • Loading branch information
ptelu committed Jul 26, 2021
1 parent d4b51e6 commit d1eb8af
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions application/models/LSActiveRecord.php
Expand Up @@ -435,10 +435,8 @@ public function decryptEncryptAttributes($action = 'decrypt')
// TODO: Use OOP polymorphism instead of switching on class names.
if ($class === 'ParticipantAttribute') {
$aParticipantAttributes = CHtml::listData(ParticipantAttributeName::model()->findAll(["select" => "attribute_id", "condition" => "encrypted = 'Y' and core_attribute <> 'Y'"]), 'attribute_id', '');
foreach ($aParticipantAttributes as $attribute => $value) {
if (array_key_exists($this->attribute_id, $aParticipantAttributes)) {
$this->value = $sodium->$action($this->value);
}
if (array_key_exists($this->attribute_id, $aParticipantAttributes)) {
$this->value = $sodium->$action($this->value);
}
} else {
$attributes = $this->encryptAttributeValues($this->attributes, true, false);
Expand Down

0 comments on commit d1eb8af

Please sign in to comment.