Skip to content

Commit

Permalink
Merge PR #702 into 18.0
Browse files Browse the repository at this point in the history
Signed-off-by simahawk
  • Loading branch information
OCA-git-bot committed Oct 19, 2024
2 parents e09a4c1 + 20c085e commit c959244
Show file tree
Hide file tree
Showing 15 changed files with 712 additions and 0 deletions.
94 changes: 94 additions & 0 deletions auth_api_key_server_env/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
===============================
Auth API key server environment
===============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e6609698db2b7ba4cab3f9aa8cfca5e51a1418bbf74c8bd802b9bce9be8c54a9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
:target: https://github.com/OCA/server-auth/tree/18.0/auth_api_key_server_env
:alt: OCA/server-auth
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-auth-18-0/server-auth-18-0-auth_api_key_server_env
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Configure api keys via server env.

This can be very useful to avoid mixing your keys between your various
environments when restoring databases. All you have to do is to add a
new section to your configuration file according to the following
convention:

.. code:: ini
[api_key_<record.tech_name>]
key=my_api_key
**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_api_key_server_env%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Camptocamp

Contributors
------------

- Simone Orsi <simone.orsi@camptocamp.com>
- Florian da Costa <florian.dacosta@akretion.com>
- Thien Vo Hong <thienvh@trobzh.com>

Other credits
-------------

The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp.

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/18.0/auth_api_key_server_env>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions auth_api_key_server_env/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions auth_api_key_server_env/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Auth API key server environment",
"summary": """
Configure api keys via server env.
This can be very useful to avoid mixing your keys between your various
environments when restoring databases. All you have to do is to add a new
section to your configuration file according to the following convention:
""",
"version": "18.0.1.0.0",
"development_status": "Production/Stable",
"license": "LGPL-3",
"website": "https://github.com/OCA/server-auth",
"author": "Camptocamp,Odoo Community Association (OCA)",
"depends": ["auth_api_key", "server_environment"],
"data": [],
}
34 changes: 34 additions & 0 deletions auth_api_key_server_env/i18n/auth_api_key_server_env.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_api_key_server_env
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: auth_api_key_server_env
#: model:ir.model,name:auth_api_key_server_env.model_auth_api_key
msgid "API Key"
msgstr ""

#. module: auth_api_key_server_env
#: model:ir.model.fields,field_description:auth_api_key_server_env.field_auth_api_key__server_env_defaults
msgid "Server Env Defaults"
msgstr ""

#. module: auth_api_key_server_env
#: model:ir.model.fields,field_description:auth_api_key_server_env.field_auth_api_key__tech_name
msgid "Tech Name"
msgstr ""

#. module: auth_api_key_server_env
#: model:ir.model.fields,help:auth_api_key_server_env.field_auth_api_key__tech_name
msgid "Unique name for technical purposes. Eg: server env keys."
msgstr ""
37 changes: 37 additions & 0 deletions auth_api_key_server_env/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_api_key_server_env
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-02-04 22:36+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: auth_api_key_server_env
#: model:ir.model,name:auth_api_key_server_env.model_auth_api_key
msgid "API Key"
msgstr "Chiave API"

#. module: auth_api_key_server_env
#: model:ir.model.fields,field_description:auth_api_key_server_env.field_auth_api_key__server_env_defaults
msgid "Server Env Defaults"
msgstr "Server ambiente predefinito"

#. module: auth_api_key_server_env
#: model:ir.model.fields,field_description:auth_api_key_server_env.field_auth_api_key__tech_name
msgid "Tech Name"
msgstr "Nome tecnico"

#. module: auth_api_key_server_env
#: model:ir.model.fields,help:auth_api_key_server_env.field_auth_api_key__tech_name
msgid "Unique name for technical purposes. Eg: server env keys."
msgstr "Nome univoco per motivi tecnici. Es: chiavi server ambiente."
1 change: 1 addition & 0 deletions auth_api_key_server_env/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import auth_api_key
29 changes: 29 additions & 0 deletions auth_api_key_server_env/models/auth_api_key.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2018 ACSONE SA/NV
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).


from odoo import models


class AuthApiKey(models.Model):
_name = "auth.api.key"
_inherit = ["auth.api.key", "server.env.techname.mixin", "server.env.mixin"]

def _server_env_section_name(self):
"""Name of the section in the configuration files
We override the default implementation to keep the compatibility
with the previous implementation of auth_api_key. The section name
into the configuration file must be formatted as
'api_key_{name}'
"""
self.ensure_one()
return f"api_key_{getattr(self, self._server_env_section_name_field)}"

@property
def _server_env_fields(self):
base_fields = super()._server_env_fields
api_key_fields = {"key": {}}
api_key_fields.update(base_fields)
return api_key_fields
3 changes: 3 additions & 0 deletions auth_api_key_server_env/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions auth_api_key_server_env/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Simone Orsi \<<simone.orsi@camptocamp.com>\>
- Florian da Costa \<<florian.dacosta@akretion.com>\>
- Thien Vo Hong \<<thienvh@trobzh.com>\>
1 change: 1 addition & 0 deletions auth_api_key_server_env/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp.
11 changes: 11 additions & 0 deletions auth_api_key_server_env/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Configure api keys via server env.

This can be very useful to avoid mixing your keys between your various
environments when restoring databases. All you have to do is to add a
new section to your configuration file according to the following
convention:

``` ini
[api_key_<record.tech_name>]
key=my_api_key
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c959244

Please sign in to comment.