Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolved bug for decryption #214

Open
wants to merge 1 commit into
base: 17.0-1.4
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions g2p_registry_encryption/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ def _fetch_query(self, query, fields):
)
if not is_decrypt_fields:
return res
for record in self:
is_encrypted, encrypted_val = record.get_encrypted_val()[0]
if is_encrypted and encrypted_val:
decrypted_vals = json.loads(prov.decrypt_data(encrypted_val).decode())

for field_name in enc_fields_set:
if field_name in decrypted_vals and field_name in record and record[field_name]:
self.env.cache.set(record, self._fields[field_name], decrypted_vals[field_name])
if len(self) == 1 and self.is_registrant:
for record in self:
is_encrypted, encrypted_val = record.get_encrypted_val()[0]
if is_encrypted and encrypted_val:
decrypted_vals = json.loads(prov.decrypt_data(encrypted_val).decode())
for field_name in enc_fields_set:
if field_name in decrypted_vals and field_name in record and record[field_name]:
self.env.cache.set(record, self._fields[field_name], decrypted_vals[field_name])

return res

def get_encrypted_val(self):
Expand Down
Loading