Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cbec6bc
Add endpoint_auth_api_key
simahawk Sep 24, 2021
387880a
endpoint_auth_api_key: add btn to manage groups
simahawk Nov 12, 2021
e3b7a36
endpoint_auth_api_key: show group mgmt btn if needed
simahawk Dec 28, 2021
f7b5e77
endpoint_auth_api_key 14.0.1.1.0
OCA-git-bot Jan 12, 2022
36a4c92
Misc fix of authorship name
simahawk Jan 14, 2022
44872bf
endpoint_auth_api_key 14.0.1.1.1
OCA-git-bot Jan 14, 2022
6f16af6
[FIX] Fix access right issues when using actions
sebalix Jan 31, 2022
16f5d50
endpoint_auth_api_key 14.0.1.1.2
OCA-git-bot Jan 31, 2022
82bcb5c
endpoint_auth_api_key: move to OCA/web-api
simahawk Aug 1, 2022
73836c3
endpoint_auth_api_key: adapt to new sync behavior
simahawk Feb 16, 2023
f2d3c88
[MIG] endpoint_auth_api_key: Migrate to version 16.0
Dec 26, 2023
a5e87be
Added translation using Weblate (Italian)
mymage Apr 2, 2024
ca059bc
endpoint: add basic mixin view
simahawk Jul 23, 2024
cf73565
endpoint_*: fix mixin view override
simahawk Aug 8, 2024
7443f1d
[IMP] endpoint_auth_api_key: pre-commit auto fixes
SilvioC2C Mar 18, 2025
3241c1a
[MIG] endpoint_auth_api_key: Migrate to version 17.0
SilvioC2C Mar 18, 2025
237a764
Added translation using Weblate (Chinese (Simplified) (zh_CN))
xtanuiha Apr 4, 2025
88ea7c4
Translated using Weblate (Chinese (Simplified) (zh_CN))
xtanuiha Apr 4, 2025
8370e11
[IMP] endpoint_auth_api_key: pre-commit auto fixes
simahawk Jun 9, 2025
c71ae2e
endpoint_auth_api_key: migrate to v18
simahawk Jun 9, 2025
10b0c13
endpoint_auth_api_key: mute http logger to avoid warning
simahawk Jun 9, 2025
d84f641
endpoint_auth_api_key: adapt test to auth_api_key changes
simahawk Jul 16, 2025
9656722
[MIG] endpoint_auth_api_key: Migration to 19.0
yankinmax Apr 1, 2026
84b8d7b
don't merge test-requirements
yankinmax Apr 1, 2026
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
102 changes: 102 additions & 0 deletions endpoint_auth_api_key/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=====================
Endpoint Auth API key
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cfd515c9f4adfa18204af3865093c9d6d00f92e79b06ce7d7e6ca353a4fc6934
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/license-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%2Fweb--api-lightgray.png?logo=github
:target: https://github.com/OCA/web-api/tree/19.0/endpoint_auth_api_key
:alt: OCA/web-api
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/web-api-19-0/web-api-19-0-endpoint_auth_api_key
: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/web-api&target_branch=19.0
:alt: Try me on Runboat

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

Provide API key auth for endpoints.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/web-api/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/web-api/issues/new?body=module:%20endpoint_auth_api_key%0Aversion:%2019.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>

- `Trobz <https://trobz.com>`__:

- Son Ho <sonhd@trobz.com>

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



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.

.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px
:target: https://github.com/simahawk
:alt: simahawk

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-simahawk|

This module is part of the `OCA/web-api <https://github.com/OCA/web-api/tree/19.0/endpoint_auth_api_key>`_ 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 endpoint_auth_api_key/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions endpoint_auth_api_key/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2021 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "Endpoint Auth API key",
"summary": """Provide API key auth for endpoints.""",
"version": "19.0.1.0.0",
"license": "LGPL-3",
"development_status": "Alpha",
"author": "Camptocamp, Odoo Community Association (OCA)",
"maintainers": ["simahawk"],
"website": "https://github.com/OCA/web-api",
"depends": ["endpoint", "auth_api_key_group"],
"data": ["views/endpoint_view.xml"],
}
30 changes: 30 additions & 0 deletions endpoint_auth_api_key/i18n/endpoint_auth_api_key.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * endpoint_auth_api_key
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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: endpoint_auth_api_key
#: model:ir.model.fields,field_description:endpoint_auth_api_key.field_endpoint_endpoint__auth_api_key_group_ids
#: model:ir.model.fields,field_description:endpoint_auth_api_key.field_endpoint_mixin__auth_api_key_group_ids
msgid "Allowed API key groups"
msgstr ""

#. module: endpoint_auth_api_key
#: model:ir.model,name:endpoint_auth_api_key.model_endpoint_mixin
msgid "Endpoint mixin"
msgstr ""

#. module: endpoint_auth_api_key
#: model_terms:ir.ui.view,arch_db:endpoint_auth_api_key.endpoint_mixin_form_view
msgid "Manage groups"
msgstr ""
33 changes: 33 additions & 0 deletions endpoint_auth_api_key/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * endpoint_auth_api_key
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-04-02 12:35+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: endpoint_auth_api_key
#: model:ir.model.fields,field_description:endpoint_auth_api_key.field_endpoint_endpoint__auth_api_key_group_ids
#: model:ir.model.fields,field_description:endpoint_auth_api_key.field_endpoint_mixin__auth_api_key_group_ids
msgid "Allowed API key groups"
msgstr "Consenti gruppi chiavi API"

#. module: endpoint_auth_api_key
#: model:ir.model,name:endpoint_auth_api_key.model_endpoint_mixin
msgid "Endpoint mixin"
msgstr "Mixin endpoint"

#. module: endpoint_auth_api_key
#: model_terms:ir.ui.view,arch_db:endpoint_auth_api_key.endpoint_mixin_form_view
msgid "Manage groups"
msgstr "Gestione gruppi"
33 changes: 33 additions & 0 deletions endpoint_auth_api_key/i18n/zh_CN.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * endpoint_auth_api_key
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-04-04 06:06+0000\n"
"Last-Translator: xtanuiha <feihu.zhang@live.com>\n"
"Language-Team: none\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.10.2\n"

#. module: endpoint_auth_api_key
#: model:ir.model.fields,field_description:endpoint_auth_api_key.field_endpoint_endpoint__auth_api_key_group_ids
#: model:ir.model.fields,field_description:endpoint_auth_api_key.field_endpoint_mixin__auth_api_key_group_ids
msgid "Allowed API key groups"
msgstr "允许的API密钥组"

#. module: endpoint_auth_api_key
#: model:ir.model,name:endpoint_auth_api_key.model_endpoint_mixin
msgid "Endpoint mixin"
msgstr "端点混入类"

#. module: endpoint_auth_api_key
#: model_terms:ir.ui.view,arch_db:endpoint_auth_api_key.endpoint_mixin_form_view
msgid "Manage groups"
msgstr "管理组"
1 change: 1 addition & 0 deletions endpoint_auth_api_key/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import endpoint_mixin
40 changes: 40 additions & 0 deletions endpoint_auth_api_key/models/endpoint_mixin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2021 Camptocamp SA
# @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import werkzeug

from odoo import fields, models


class EndpointMixin(models.AbstractModel):
_inherit = "endpoint.mixin"

auth_api_key_group_ids = fields.Many2many(
comodel_name="auth.api.key.group",
string="Allowed API key groups",
)

def _selection_auth_type(self):
return super()._selection_auth_type() + [("api_key", "API key")]

def _validate_request(self, request):
super()._validate_request(request)
if self.auth_type == "api_key":
self._validate_api_key(request)
return

def _validate_api_key(self, request):
key_id = request.auth_api_key_id
if key_id not in self._allowed_api_key_ids():
self._logger.error("API key %s not allowed on %s", key_id, self.route)
raise werkzeug.exceptions.Forbidden()

def _allowed_api_key_ids(self):
return self.auth_api_key_group_ids.auth_api_key_ids.ids

def action_view_api_key_groups(self):
xmlid = "auth_api_key_group.auth_api_key_group_act_window"
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
action["domain"] = [("id", "in", self.auth_api_key_group_ids.ids)]
return action
3 changes: 3 additions & 0 deletions endpoint_auth_api_key/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions endpoint_auth_api_key/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Simone Orsi \<<simone.orsi@camptocamp.com>\>

- [Trobz](https://trobz.com):

> - Son Ho \<<sonhd@trobz.com>\>
Empty file.
1 change: 1 addition & 0 deletions endpoint_auth_api_key/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Provide API key auth for endpoints.
Binary file added endpoint_auth_api_key/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading