Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from lalithkota/15.0-develop
Browse files Browse the repository at this point in the history
Fixed crypto admin group access and fixed update prov bug
  • Loading branch information
shibu-narayanan authored Apr 23, 2024
2 parents 7e84f56 + c1333f5 commit d72ab2b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 49 deletions.
7 changes: 4 additions & 3 deletions g2p_encryption/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down
7 changes: 4 additions & 3 deletions g2p_encryption_keymanager/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down
7 changes: 4 additions & 3 deletions g2p_encryption_rest_api/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down
6 changes: 4 additions & 2 deletions g2p_registry_encryption/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def create(self, vals_list):
if not is_encrypt_fields:
return super().create(vals_list)

vals_list = [vals_list] if isinstance(vals_list, dict) else vals_list

prov = self.env["g2p.encryption.provider"].get_registry_provider()
for vals in vals_list:
if vals.get("is_registrant", False):
Expand Down Expand Up @@ -62,15 +64,15 @@ def write(self, vals):
vals = rec_values_list
else:
vals = json.loads(prov.decrypt_data(encrypted_val).decode()).update(vals)
to_be_encrypted = self.gather_fields_to_be_enc_from_dict(vals)
to_be_encrypted = self.gather_fields_to_be_enc_from_dict(vals, prov)

vals["encrypted_val"] = prov.encrypt_data(json.dumps(to_be_encrypted).encode())

return super().write(vals)

def _read(self, fields):
fields = set(fields)
res = super()._read(fields)
fields = set(fields)
prov = self.env["g2p.encryption.provider"].get_registry_provider()
enc_fields_set = prov.get_registry_fields_set_to_enc().intersection(fields)
if not enc_fields_set:
Expand Down
7 changes: 4 additions & 3 deletions g2p_registry_encryption/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down
72 changes: 37 additions & 35 deletions g2p_registry_encryption/views/res_config_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,45 @@
<field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='g2p_config_settings']" position="inside">
<h2>G2P Registry Encryption Settings</h2>
<div class="row mt16 o_settings_container" name="encryption_settings_container">
<div
class="col-12 col-lg-6 o_setting_box"
id="registry_encryption_provider_config"
title="Registry Encryption Provider Config"
>
<div class="o_setting_right_pane">
<label
for="registry_encryption_provider"
string="Encryption Provider for Registry"
/>
<field name="registry_encryption_provider" />
<div name="encryption_settings_block" groups="g2p_encryption.crypto_admin">
<h2>G2P Registry Encryption Settings</h2>
<div class="row mt16 o_settings_container" name="encryption_settings_block">
<div
class="col-12 col-lg-6 o_setting_box"
id="registry_encryption_provider_config"
title="Registry Encryption Provider Config"
>
<div class="o_setting_right_pane">
<label
for="registry_encryption_provider"
string="Encryption Provider for Registry"
/>
<field name="registry_encryption_provider" />
</div>
</div>
</div>
<div
class="col-12 col-lg-6 o_setting_box"
id="encrypt_registry_config"
title="Encrypt Registry Config"
>
<div class="o_setting_right_pane">
<field name="encrypt_registry" />
<label for="encrypt_registry" string="Encrypt Registry fields" />
<span class="text-muted">This option enables registry fields encryption</span>
<div
class="col-12 col-lg-6 o_setting_box"
id="encrypt_registry_config"
title="Encrypt Registry Config"
>
<div class="o_setting_right_pane">
<field name="encrypt_registry" />
<label for="encrypt_registry" string="Encrypt Registry fields" />
<span class="text-muted">This option enables registry fields encryption</span>
</div>
</div>
</div>
<div
class="col-12 col-lg-6 o_setting_box"
id="decrypt_registry_config"
title="Decrypt Registry Config"
>
<div class="o_setting_right_pane">
<field name="decrypt_registry" />
<label for="decrypt_registry" string="Decrypt Registry fields" />
<span
class="text-muted"
>By choosing this, you are consenting to decrypting fields on registry. So be careful</span>
<div
class="col-12 col-lg-6 o_setting_box"
id="decrypt_registry_config"
title="Decrypt Registry Config"
>
<div class="o_setting_right_pane">
<field name="decrypt_registry" />
<label for="decrypt_registry" string="Decrypt Registry fields" />
<span
class="text-muted"
>By choosing this, you are consenting to decrypting fields on registry. So be careful</span>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit d72ab2b

Please sign in to comment.