forked from shopinvader/odoo-shopinvader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s_locomotive_algolia: do not expose private key
Prior to this change the private API key was sent to Locomotive frontend which exposes it into pages source code (!!!). In any case, Locomotive does not need any admin access to the indexes. This change fixes the security breach.
- Loading branch information
Showing
7 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import component | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import se_backend_algolia |
25 changes: 25 additions & 0 deletions
25
shopinvader_locomotive_algolia/models/se_backend_algolia.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2020 Camptocamp (http://www.camptocamp.com). | ||
# @author Simone Orsi <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
class SeBackendAlgolia(models.Model): | ||
_inherit = "se.backend.algolia" | ||
|
||
# change help msg | ||
algolia_api_key = fields.Char( | ||
help="Admin API key with rights to write on indexes" | ||
) | ||
algolia_api_key_public = fields.Char( | ||
string="Public API KEY", | ||
help="Readonly API key with rights to search only", | ||
) | ||
|
||
@property | ||
def _server_env_fields(self): | ||
env_fields = super()._server_env_fields | ||
env_fields.update({"algolia_api_key_public": {}}) | ||
return env_fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
shopinvader_locomotive_algolia/views/se_backend_algolia.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record model="ir.ui.view" id="se_backend_algolia_form_view"> | ||
<field name="model">se.backend.algolia</field> | ||
<field name="inherit_id" ref="connector_algolia.se_backend_algolia_form_view" /> | ||
<field name="arch" type="xml"> | ||
<field name="algolia_api_key" position="after"> | ||
<field name="algolia_api_key_public" /> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |