From ce71c82588e580f91fb68aa9bbcead034a6c5ae8 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Wed, 15 Dec 2021 16:23:49 +0200 Subject: [PATCH] [MIG] base_rest_auth_jwt: Migration to 15.0 --- .pre-commit-config.yaml | 1 - base_rest_auth_jwt/README.rst | 10 +++++----- base_rest_auth_jwt/__manifest__.py | 4 ++-- .../apispec/rest_method_security_plugin.py | 9 ++++----- base_rest_auth_jwt/components/service.py | 2 +- base_rest_auth_jwt/i18n/base_rest_auth_jwt.pot | 2 +- base_rest_auth_jwt/static/description/index.html | 6 +++--- .../base_rest_auth_jwt/odoo/addons/base_rest_auth_jwt | 1 + setup/base_rest_auth_jwt/setup.py | 6 ++++++ test-requirements.txt | 1 + 10 files changed, 24 insertions(+), 18 deletions(-) create mode 120000 setup/base_rest_auth_jwt/odoo/addons/base_rest_auth_jwt create mode 100644 setup/base_rest_auth_jwt/setup.py create mode 100644 test-requirements.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 52037871b..bdcf78b70 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ exclude: | (?x) # NOT INSTALLABLE ADDONS - ^base_rest_auth_jwt/| ^base_rest_auth_user_service/| ^graphql_base/| ^graphql_demo/| diff --git a/base_rest_auth_jwt/README.rst b/base_rest_auth_jwt/README.rst index ba75739d4..88cadd6e5 100644 --- a/base_rest_auth_jwt/README.rst +++ b/base_rest_auth_jwt/README.rst @@ -14,13 +14,13 @@ Base Rest Auth Jwt :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github - :target: https://github.com/OCA/rest-framework/tree/14.0/base_rest_auth_jwt + :target: https://github.com/OCA/rest-framework/tree/15.0/base_rest_auth_jwt :alt: OCA/rest-framework .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/rest-framework-14-0/rest-framework-14-0-base_rest_auth_jwt + :target: https://translation.odoo-community.org/projects/rest-framework-15-0/rest-framework-15-0-base_rest_auth_jwt :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/271/14.0 + :target: https://runbot.odoo-community.org/runbot/271/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -40,7 +40,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -78,6 +78,6 @@ Current `maintainer `__: |maintainer-lmignon| -This module is part of the `OCA/rest-framework `_ project on GitHub. +This module is part of the `OCA/rest-framework `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_rest_auth_jwt/__manifest__.py b/base_rest_auth_jwt/__manifest__.py index 7d47d83db..dceec44bd 100644 --- a/base_rest_auth_jwt/__manifest__.py +++ b/base_rest_auth_jwt/__manifest__.py @@ -6,13 +6,13 @@ "summary": """ Base Rest: Add support for the auth_jwt security policy into the openapi documentation""", - "version": "14.0.1.1.0", + "version": "15.0.1.0.0", "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/rest-framework", "depends": ["base_rest", "auth_jwt"], "maintainers": ["lmignon"], - "installable": False, + "installable": True, "auto_install": True, "external_dependencies": { "python": [ diff --git a/base_rest_auth_jwt/apispec/rest_method_security_plugin.py b/base_rest_auth_jwt/apispec/rest_method_security_plugin.py index c728bd4be..089791343 100644 --- a/base_rest_auth_jwt/apispec/rest_method_security_plugin.py +++ b/base_rest_auth_jwt/apispec/rest_method_security_plugin.py @@ -6,11 +6,11 @@ class RestMethodSecurityPlugin(BasePlugin): def __init__(self, service): - super(RestMethodSecurityPlugin, self).__init__() + super().__init__() self._service = service def init_spec(self, spec): - super(RestMethodSecurityPlugin, self).init_spec(spec) + super().init_spec(spec) self.spec = spec self.openapi_version = spec.openapi_version jwt_scheme = { @@ -21,13 +21,12 @@ def init_spec(self, spec): "description": "Enter JWT Bearer Token ** only **", } spec.components.security_scheme("jwt", jwt_scheme) + return def operation_helper(self, path=None, operations=None, **kwargs): routing = kwargs.get("routing") if not routing: - super(RestMethodSecurityPlugin, self).operation_helper( - path, operations, **kwargs - ) + super().operation_helper(path, operations, **kwargs) if not operations: return auth = routing.get("auth", self.spec._params.get("default_auth")) diff --git a/base_rest_auth_jwt/components/service.py b/base_rest_auth_jwt/components/service.py index d11159499..4ee6e84c6 100644 --- a/base_rest_auth_jwt/components/service.py +++ b/base_rest_auth_jwt/components/service.py @@ -10,7 +10,7 @@ class BaseRestService(AbstractComponent): _inherit = "base.rest.service" def _get_api_spec(self, **params): - spec = super(BaseRestService, self)._get_api_spec(**params) + spec = super()._get_api_spec(**params) plugin = RestMethodSecurityPlugin(self) plugin.init_spec(spec) spec.plugins.append(plugin) diff --git a/base_rest_auth_jwt/i18n/base_rest_auth_jwt.pot b/base_rest_auth_jwt/i18n/base_rest_auth_jwt.pot index 4d8b20f91..a11baf5cd 100644 --- a/base_rest_auth_jwt/i18n/base_rest_auth_jwt.pot +++ b/base_rest_auth_jwt/i18n/base_rest_auth_jwt.pot @@ -3,7 +3,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/base_rest_auth_jwt/static/description/index.html b/base_rest_auth_jwt/static/description/index.html index 7672d0b11..7aa3df4a8 100644 --- a/base_rest_auth_jwt/static/description/index.html +++ b/base_rest_auth_jwt/static/description/index.html @@ -367,7 +367,7 @@

Base Rest Auth Jwt

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runbot

This technical addon extend base_rest to add the support for auth_jwt authentication mechanism into the generated openapi documentation.

Table of contents

@@ -387,7 +387,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -413,7 +413,7 @@

Maintainers

promote its widespread use.

Current maintainer:

lmignon

-

This module is part of the OCA/rest-framework project on GitHub.

+

This module is part of the OCA/rest-framework project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/setup/base_rest_auth_jwt/odoo/addons/base_rest_auth_jwt b/setup/base_rest_auth_jwt/odoo/addons/base_rest_auth_jwt new file mode 120000 index 000000000..ee27a164f --- /dev/null +++ b/setup/base_rest_auth_jwt/odoo/addons/base_rest_auth_jwt @@ -0,0 +1 @@ +../../../../base_rest_auth_jwt \ No newline at end of file diff --git a/setup/base_rest_auth_jwt/setup.py b/setup/base_rest_auth_jwt/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/base_rest_auth_jwt/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..ec3e7775b --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-auth_jwt @ git+https://github.com/OCA/server-auth@refs/pull/316/head#subdirectory=setup/auth_jwt