From f9307181ec944328f2e2d2566790c6de47d42b01 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Wed, 31 Jan 2018 17:30:50 +0100 Subject: [PATCH 001/138] New generic module du define REST services --- auth_api_key/models/__init__.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 auth_api_key/models/__init__.py diff --git a/auth_api_key/models/__init__.py b/auth_api_key/models/__init__.py new file mode 100644 index 000000000..01b3640a4 --- /dev/null +++ b/auth_api_key/models/__init__.py @@ -0,0 +1,2 @@ +from . import ir_http +from . import invader_entrypoint From ee660e567d1a3d95a8dcabf83e6024a98027834f Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Thu, 1 Feb 2018 00:20:26 +0100 Subject: [PATCH 002/138] auth_api_key: New module to provide authentication by api_key --- auth_api_key/README.rst | 85 +++++++++++++++++++++++ auth_api_key/__init__.py | 1 + auth_api_key/__manifest__.py | 22 ++++++ auth_api_key/models/__init__.py | 3 +- auth_api_key/models/auth_api_key.py | 49 +++++++++++++ auth_api_key/models/ir_http.py | 39 +++++++++++ auth_api_key/models/keychain_account.py | 21 ++++++ auth_api_key/security/auth_api_key.xml | 17 +++++ auth_api_key/static/description/icon.png | Bin 0 -> 9455 bytes auth_api_key/views/auth_api_key.xml | 51 ++++++++++++++ 10 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 auth_api_key/README.rst create mode 100644 auth_api_key/__init__.py create mode 100644 auth_api_key/__manifest__.py create mode 100644 auth_api_key/models/auth_api_key.py create mode 100644 auth_api_key/models/ir_http.py create mode 100644 auth_api_key/models/keychain_account.py create mode 100644 auth_api_key/security/auth_api_key.xml create mode 100644 auth_api_key/static/description/icon.png create mode 100644 auth_api_key/views/auth_api_key.xml diff --git a/auth_api_key/README.rst b/auth_api_key/README.rst new file mode 100644 index 000000000..f562e2611 --- /dev/null +++ b/auth_api_key/README.rst @@ -0,0 +1,85 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============ +Auth Api Key +============ + +Authenticate http requests from an API key + + +Configuration +============= + +The api key must be provided by the coniguration parameter named +'auth_api_key.api_key'. +To apply this authentication system to your http request you must set 'api_key' +as value for the 'auth' parameter of your route definition into your controller. + + :: + + class MyController(Controller): + + @route('/my_service', auth='api_key', ...) + def my_service(self, *args, **kwargs): + pass + +Usage +===== + +To use this module, you need to: + +#. Go to ... + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + +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 smash it by providing detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Firstname Lastname +* Second Person + +Funders +------- + +The development of this module has been financially supported by: + +* Company 1 name +* Company 2 name + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/auth_api_key/__init__.py b/auth_api_key/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/auth_api_key/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/auth_api_key/__manifest__.py b/auth_api_key/__manifest__.py new file mode 100644 index 000000000..8294eb056 --- /dev/null +++ b/auth_api_key/__manifest__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Auth Api Key', + 'summary': """ + Authenticate http requests from an API key""", + 'version': '10.0.1.0.0', + 'license': 'AGPL-3', + 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', + 'website': 'https://acsone.eu/', + 'depends': [ + 'keychain' + ], + 'data': [ + 'security/auth_api_key.xml', + 'views/auth_api_key.xml', + ], + 'demo': [ + ], +} diff --git a/auth_api_key/models/__init__.py b/auth_api_key/models/__init__.py index 01b3640a4..389ec3bba 100644 --- a/auth_api_key/models/__init__.py +++ b/auth_api_key/models/__init__.py @@ -1,2 +1,3 @@ from . import ir_http -from . import invader_entrypoint +from . import keychain_account +from . import auth_api_key diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py new file mode 100644 index 000000000..2adf2c25b --- /dev/null +++ b/auth_api_key/models/auth_api_key.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models, tools + + +class AuthApiKey(models.Model): + _name = 'auth.api.key' + _inherit = 'keychain.backend' + _backend_name = 'auth_api_key' + + @api.model + def _default_user_id(self): + return self.env.user + + user_id = fields.Many2one( + 'res.users', + 'User', + required=True, + help="The user used to execute the code into Odoo when user is called " + "with this api key.", + default=_default_user_id + ) + + @api.multi + def _inverse_password(self): + self.retrieve_id_by_api_key.clear_cache(self) + ret = super(AuthApiKey, self)._inverse_password() + return ret + + @api.model + def retrieve_from_api_key(self, api_key): + return self.browse(self.retrieve_id_by_api_key().get(api_key, [])) + + @api.model + @tools.ormcache('self.env.uid', 'self._backend_name', 'self._name') + def retrieve_id_by_api_key(self): + keychain_account = self.env['keychain.account'] + keychain_accounts = keychain_account.search([ + ('namespace', '=', self._backend_name), + ('technical_name', 'like', self._name) + ]) + res = {} + for key in keychain_accounts: + _id = int(key.technical_name.split(',')[1]) + api_key = key.get_password() + res[api_key] = _id + return res diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py new file mode 100644 index 000000000..5ae09d91d --- /dev/null +++ b/auth_api_key/models/ir_http.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 ACSONE SA/NV +# Copyright 2017 Akretion (http://www.akretion.com). +# @author Sébastien BEAU +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +from odoo.http import request +from odoo import models +from werkzeug.exceptions import Unauthorized + + +_logger = logging.getLogger(__name__) + + +class IrHttp(models.AbstractModel): + _inherit = 'ir.http' + + @classmethod + def _auth_method_api_key(cls): + headers = request.httprequest.environ + api_key = headers.get('HTTP_API_KEY') + if api_key: + request.uid = 1 + auth_api_key = request.env['auth.api.key'].retrieve_from_api_key( + api_key + ) + if api_key: + # reset _env on the request since we change the uid... + # the next call to env will instantiate an new + # odoo.api.Environment with the user defined on the + # auth.api_key + request._env = None + request.uid = auth_api_key.user_id.id + request.auth_api_key = auth_api_key + return True + _logger.error("Wrong HTTP_API_KEY, access denied") + raise Unauthorized("Access denied") diff --git a/auth_api_key/models/keychain_account.py b/auth_api_key/models/keychain_account.py new file mode 100644 index 000000000..02f46c76a --- /dev/null +++ b/auth_api_key/models/keychain_account.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class KeychainAccount(models.Model): + + _inherit = 'keychain.account' + + namespace = fields.Selection( + selection_add=[('auth_api_key', 'Search Engine Backend')]) + + @api.multi + def _auth_api_key_validate_data(self, data): + return True + + @api.multi + def _auth_api_key_init_data(self): + return {} diff --git a/auth_api_key/security/auth_api_key.xml b/auth_api_key/security/auth_api_key.xml new file mode 100644 index 000000000..2ad7762da --- /dev/null +++ b/auth_api_key/security/auth_api_key.xml @@ -0,0 +1,17 @@ + + + + + + + auth.api.key access manage + + + + + + + + + diff --git a/auth_api_key/static/description/icon.png b/auth_api_key/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44c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>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/auth_api_key/views/auth_api_key.xml b/auth_api_key/views/auth_api_key.xml new file mode 100644 index 000000000..6937bab74 --- /dev/null +++ b/auth_api_key/views/auth_api_key.xml @@ -0,0 +1,51 @@ + + + + + + + auth.api.key.form (in auth_api_key) + auth.api.key + +
+ + +
+
+
+ + + + auth.api.key.tree (in auth_api_key) + auth.api.key + + + + + + + + + Auth Api Key + auth.api.key + tree,form + [] + {} + + + + Auth Api Key + + + + + +
From d45cf207f4689f9f0528d07c91633db02f4c44d0 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Fri, 2 Feb 2018 16:26:45 +0100 Subject: [PATCH 003/138] auth_api_key: Remove useless code --- auth_api_key/models/auth_api_key.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 2adf2c25b..7528db41d 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -26,8 +26,7 @@ def _default_user_id(self): @api.multi def _inverse_password(self): self.retrieve_id_by_api_key.clear_cache(self) - ret = super(AuthApiKey, self)._inverse_password() - return ret + return super(AuthApiKey, self)._inverse_password() @api.model def retrieve_from_api_key(self, api_key): From 479e3746c976b6ea54d9ec76f9cedb244bdd90a3 Mon Sep 17 00:00:00 2001 From: "Denis Robinet (ACSONE)" Date: Mon, 19 Feb 2018 15:30:01 +0100 Subject: [PATCH 004/138] Update the auth_api_key for keychan 10.0.2 (renamed method) --- auth_api_key/models/auth_api_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 7528db41d..8a7d40171 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -43,6 +43,6 @@ def retrieve_id_by_api_key(self): res = {} for key in keychain_accounts: _id = int(key.technical_name.split(',')[1]) - api_key = key.get_password() + api_key = key._get_password() res[api_key] = _id return res From 00d83d5d4ce02aab97c5de21c9b855496d3190e0 Mon Sep 17 00:00:00 2001 From: "Denis Robinet (ACSONE)" Date: Mon, 19 Feb 2018 15:31:24 +0100 Subject: [PATCH 005/138] Fix the authentification method and show the user_id on the form --- auth_api_key/models/ir_http.py | 2 +- auth_api_key/views/auth_api_key.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py index 5ae09d91d..6e77c0738 100644 --- a/auth_api_key/models/ir_http.py +++ b/auth_api_key/models/ir_http.py @@ -26,7 +26,7 @@ def _auth_method_api_key(cls): auth_api_key = request.env['auth.api.key'].retrieve_from_api_key( api_key ) - if api_key: + if auth_api_key: # reset _env on the request since we change the uid... # the next call to env will instantiate an new # odoo.api.Environment with the user defined on the diff --git a/auth_api_key/views/auth_api_key.xml b/auth_api_key/views/auth_api_key.xml index 6937bab74..eca677d51 100644 --- a/auth_api_key/views/auth_api_key.xml +++ b/auth_api_key/views/auth_api_key.xml @@ -15,6 +15,7 @@ + From 648682d4a8f16c5de5cc1dc5fd4f8895a5bcb06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Sun, 25 Feb 2018 19:39:24 +0100 Subject: [PATCH 006/138] refactor code in order to use generic code from base_rest instead of custom one from shopinvader --- auth_api_key/models/ir_http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py index 6e77c0738..dd777c239 100644 --- a/auth_api_key/models/ir_http.py +++ b/auth_api_key/models/ir_http.py @@ -8,7 +8,7 @@ from odoo.http import request from odoo import models -from werkzeug.exceptions import Unauthorized +from odoo.exceptions import AccessDenied _logger = logging.getLogger(__name__) @@ -36,4 +36,4 @@ def _auth_method_api_key(cls): request.auth_api_key = auth_api_key return True _logger.error("Wrong HTTP_API_KEY, access denied") - raise Unauthorized("Access denied") + raise AccessDenied() From bffe1228dd124a4a713a4a49bb51b51eb98afab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Wed, 29 Aug 2018 09:05:14 +0200 Subject: [PATCH 007/138] fix wrong name in selection box --- auth_api_key/models/keychain_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_api_key/models/keychain_account.py b/auth_api_key/models/keychain_account.py index 02f46c76a..3c919fa45 100644 --- a/auth_api_key/models/keychain_account.py +++ b/auth_api_key/models/keychain_account.py @@ -10,7 +10,7 @@ class KeychainAccount(models.Model): _inherit = 'keychain.account' namespace = fields.Selection( - selection_add=[('auth_api_key', 'Search Engine Backend')]) + selection_add=[('auth_api_key', 'Authentification Api key')]) @api.multi def _auth_api_key_validate_data(self, data): From 90f6942af6c504fd9a57ed2db8fda9ccbe0d187e Mon Sep 17 00:00:00 2001 From: hparfr Date: Wed, 17 Oct 2018 12:51:51 +0200 Subject: [PATCH 008/138] Since keychain 10.0.2.0.1 there is a default validation method --- auth_api_key/models/keychain_account.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/auth_api_key/models/keychain_account.py b/auth_api_key/models/keychain_account.py index 3c919fa45..80168d751 100644 --- a/auth_api_key/models/keychain_account.py +++ b/auth_api_key/models/keychain_account.py @@ -2,7 +2,7 @@ # Copyright 2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import fields, models class KeychainAccount(models.Model): @@ -11,11 +11,3 @@ class KeychainAccount(models.Model): namespace = fields.Selection( selection_add=[('auth_api_key', 'Authentification Api key')]) - - @api.multi - def _auth_api_key_validate_data(self, data): - return True - - @api.multi - def _auth_api_key_init_data(self): - return {} From 185c0bb1aa365383c0ad1af9e5a25cc95742048c Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Tue, 6 Nov 2018 12:34:52 +0100 Subject: [PATCH 009/138] Keychain removed Get rid of keychain dependency --- auth_api_key/__manifest__.py | 24 ++++------ auth_api_key/models/__init__.py | 1 - auth_api_key/models/auth_api_key.py | 61 ++++++++++--------------- auth_api_key/models/ir_http.py | 12 ++--- auth_api_key/models/keychain_account.py | 13 ------ auth_api_key/readme/CONFIGURE.rst | 2 + auth_api_key/readme/CONTRIBUTORS.rst | 4 ++ auth_api_key/readme/DESCRIPTION.rst | 1 + auth_api_key/readme/USAGE.rst | 9 ++++ auth_api_key/security/auth_api_key.xml | 17 ------- auth_api_key/tests/__init__.py | 1 + auth_api_key/tests/test_auth_api_key.py | 35 ++++++++++++++ auth_api_key/views/auth_api_key.xml | 52 --------------------- 13 files changed, 90 insertions(+), 142 deletions(-) delete mode 100644 auth_api_key/models/keychain_account.py create mode 100644 auth_api_key/readme/CONFIGURE.rst create mode 100644 auth_api_key/readme/CONTRIBUTORS.rst create mode 100644 auth_api_key/readme/DESCRIPTION.rst create mode 100644 auth_api_key/readme/USAGE.rst delete mode 100644 auth_api_key/security/auth_api_key.xml create mode 100644 auth_api_key/tests/__init__.py create mode 100644 auth_api_key/tests/test_auth_api_key.py delete mode 100644 auth_api_key/views/auth_api_key.xml diff --git a/auth_api_key/__manifest__.py b/auth_api_key/__manifest__.py index 8294eb056..7b68da7c4 100644 --- a/auth_api_key/__manifest__.py +++ b/auth_api_key/__manifest__.py @@ -3,20 +3,14 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Auth Api Key', - 'summary': """ + "name": "Auth Api Key", + "summary": """ Authenticate http requests from an API key""", - 'version': '10.0.1.0.0', - 'license': 'AGPL-3', - 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', - 'website': 'https://acsone.eu/', - 'depends': [ - 'keychain' - ], - 'data': [ - 'security/auth_api_key.xml', - 'views/auth_api_key.xml', - ], - 'demo': [ - ], + "version": "10.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://acsone.eu/", + "depends": ["server_environment"], + "data": [], + "demo": [], } diff --git a/auth_api_key/models/__init__.py b/auth_api_key/models/__init__.py index 389ec3bba..dee3379fe 100644 --- a/auth_api_key/models/__init__.py +++ b/auth_api_key/models/__init__.py @@ -1,3 +1,2 @@ from . import ir_http -from . import keychain_account from . import auth_api_key diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 8a7d40171..733bd10f0 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -4,45 +4,32 @@ from odoo import api, fields, models, tools +from odoo.addons.server_environment import serv_config -class AuthApiKey(models.Model): - _name = 'auth.api.key' - _inherit = 'keychain.backend' - _backend_name = 'auth_api_key' +from odoo.exceptions import ValidationError, AccessError - @api.model - def _default_user_id(self): - return self.env.user - - user_id = fields.Many2one( - 'res.users', - 'User', - required=True, - help="The user used to execute the code into Odoo when user is called " - "with this api key.", - default=_default_user_id - ) - - @api.multi - def _inverse_password(self): - self.retrieve_id_by_api_key.clear_cache(self) - return super(AuthApiKey, self)._inverse_password() - @api.model - def retrieve_from_api_key(self, api_key): - return self.browse(self.retrieve_id_by_api_key().get(api_key, [])) +class AuthApiKey(models.TransientModel): + _name = "auth.api.key" @api.model - @tools.ormcache('self.env.uid', 'self._backend_name', 'self._name') - def retrieve_id_by_api_key(self): - keychain_account = self.env['keychain.account'] - keychain_accounts = keychain_account.search([ - ('namespace', '=', self._backend_name), - ('technical_name', 'like', self._name) - ]) - res = {} - for key in keychain_accounts: - _id = int(key.technical_name.split(',')[1]) - api_key = key._get_password() - res[api_key] = _id - return res + @tools.ormcache("api_key") + def _retrieve_uid_from_api_key(self, api_key): + if not self.env.user.has_group("base.group_system"): + raise AccessError("User is not allowed") + + for section in serv_config.sections(): + if section.startswith("api_key_") and serv_config.has_option( + section, "key" + ): + if api_key != serv_config.get(section, "key"): + continue + + login_name = serv_config.get(section, "user") + uid = self.env["res.users"].search([("login", "=", login_name)]).id + + if not uid: + raise ValidationError("No user found with login %s" % login_name) + + return uid + return False diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py index dd777c239..dd1483a64 100644 --- a/auth_api_key/models/ir_http.py +++ b/auth_api_key/models/ir_http.py @@ -15,24 +15,22 @@ class IrHttp(models.AbstractModel): - _inherit = 'ir.http' + _inherit = "ir.http" @classmethod def _auth_method_api_key(cls): headers = request.httprequest.environ - api_key = headers.get('HTTP_API_KEY') + api_key = headers.get("HTTP_API_KEY") if api_key: request.uid = 1 - auth_api_key = request.env['auth.api.key'].retrieve_from_api_key( - api_key - ) - if auth_api_key: + uid = request.env["auth.api.key"].retrieve_uid_from_api_key(api_key) + if uid: # reset _env on the request since we change the uid... # the next call to env will instantiate an new # odoo.api.Environment with the user defined on the # auth.api_key request._env = None - request.uid = auth_api_key.user_id.id + request.uid = uid request.auth_api_key = auth_api_key return True _logger.error("Wrong HTTP_API_KEY, access denied") diff --git a/auth_api_key/models/keychain_account.py b/auth_api_key/models/keychain_account.py deleted file mode 100644 index 80168d751..000000000 --- a/auth_api_key/models/keychain_account.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2018 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class KeychainAccount(models.Model): - - _inherit = 'keychain.account' - - namespace = fields.Selection( - selection_add=[('auth_api_key', 'Authentification Api key')]) diff --git a/auth_api_key/readme/CONFIGURE.rst b/auth_api_key/readme/CONFIGURE.rst new file mode 100644 index 000000000..0c2c0538e --- /dev/null +++ b/auth_api_key/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +The api key must be provided by the coniguration parameter named +'api_key_*.key', and the user under the same option 'api_key_*.user'. \ No newline at end of file diff --git a/auth_api_key/readme/CONTRIBUTORS.rst b/auth_api_key/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..765b55149 --- /dev/null +++ b/auth_api_key/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Denis Robinet <> +* Laurent Mignon <> +* Quentin Groulard <> +* Sébastien Beau <> \ No newline at end of file diff --git a/auth_api_key/readme/DESCRIPTION.rst b/auth_api_key/readme/DESCRIPTION.rst new file mode 100644 index 000000000..dd9562ef5 --- /dev/null +++ b/auth_api_key/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Authenticate http requests from an API key. \ No newline at end of file diff --git a/auth_api_key/readme/USAGE.rst b/auth_api_key/readme/USAGE.rst new file mode 100644 index 000000000..4464ca59c --- /dev/null +++ b/auth_api_key/readme/USAGE.rst @@ -0,0 +1,9 @@ +To apply this authentication system to your http request you must set 'api_key' +as value for the 'auth' parameter of your route definition into your controller. + + + class MyController(Controller): + + @route('/my_service', auth='api_key', ...) + def my_service(self, *args, **kwargs): + pass \ No newline at end of file diff --git a/auth_api_key/security/auth_api_key.xml b/auth_api_key/security/auth_api_key.xml deleted file mode 100644 index 2ad7762da..000000000 --- a/auth_api_key/security/auth_api_key.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - auth.api.key access manage - - - - - - - - - diff --git a/auth_api_key/tests/__init__.py b/auth_api_key/tests/__init__.py new file mode 100644 index 000000000..56e3e32a3 --- /dev/null +++ b/auth_api_key/tests/__init__.py @@ -0,0 +1 @@ +from . import test_auth_api_key diff --git a/auth_api_key/tests/test_auth_api_key.py b/auth_api_key/tests/test_auth_api_key.py new file mode 100644 index 000000000..dd43eb4f3 --- /dev/null +++ b/auth_api_key/tests/test_auth_api_key.py @@ -0,0 +1,35 @@ +from odoo.tests.common import TransactionCase +from odoo.addons.server_environment import serv_config +from odoo.exceptions import ValidationError, AccessError + + +class TestAuthApiKey(TransactionCase): + @classmethod + def setUpClass(cls, *args, **kwargs): + super(TestAuthApiKey, cls).setUpClass(*args, **kwargs) + + serv_config.add_section("api_key_good") + serv_config.set("api_key_good", "user", "demo") + serv_config.set("api_key_good", "key", "api_right_key") + serv_config.add_section("api_key_bad") + serv_config.set("api_key_bad", "user", "not_demo") + serv_config.set("api_key_bad", "key", "api_wrong_key") + + def test_lookup(self): + demo_user = self.env.ref("base.user_demo") + self.assertEqual( + self.env["auth.api.key"]._retrieve_uid_from_api_key("api_right_key"), + demo_user.id, + ) + + def test_wrong_key(self): + with self.assertRaises(ValidationError), self.env.cr.savepoint(): + self.env["auth.api.key"]._retrieve_uid_from_api_key("api_wrong_key") + + def test_user_not_allowed(self): + demo_user = self.env.ref("base.user_demo") + with self.assertRaises(AccessError), self.env.cr.savepoint(): + self.env["auth.api.key"].sudo(user=demo_user)._retrieve_uid_from_api_key( + "api_wrong_key" + ) + diff --git a/auth_api_key/views/auth_api_key.xml b/auth_api_key/views/auth_api_key.xml deleted file mode 100644 index eca677d51..000000000 --- a/auth_api_key/views/auth_api_key.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - auth.api.key.form (in auth_api_key) - auth.api.key - -
- - -
-
-
- - - - auth.api.key.tree (in auth_api_key) - auth.api.key - - - - - - - - - Auth Api Key - auth.api.key - tree,form - [] - {} - - - - Auth Api Key - - - - - -
From b3630a08c9d71e040e558bcb7301fdb327211175 Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Thu, 8 Nov 2018 11:06:58 +0100 Subject: [PATCH 010/138] Update Readme with more details --- auth_api_key/README.rst | 85 ---------------------------- auth_api_key/readme/CONFIGURE.rst | 10 +++- auth_api_key/readme/CONTRIBUTORS.rst | 8 +-- auth_api_key/readme/DESCRIPTION.rst | 6 +- 4 files changed, 17 insertions(+), 92 deletions(-) delete mode 100644 auth_api_key/README.rst diff --git a/auth_api_key/README.rst b/auth_api_key/README.rst deleted file mode 100644 index f562e2611..000000000 --- a/auth_api_key/README.rst +++ /dev/null @@ -1,85 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - -============ -Auth Api Key -============ - -Authenticate http requests from an API key - - -Configuration -============= - -The api key must be provided by the coniguration parameter named -'auth_api_key.api_key'. -To apply this authentication system to your http request you must set 'api_key' -as value for the 'auth' parameter of your route definition into your controller. - - :: - - class MyController(Controller): - - @route('/my_service', auth='api_key', ...) - def my_service(self, *args, **kwargs): - pass - -Usage -===== - -To use this module, you need to: - -#. Go to ... - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} - -.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt -.. branch is "8.0" for example - -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 smash it by providing detailed and welcomed feedback. - -Credits -======= - -Images ------- - -* Odoo Community Association: `Icon `_. - -Contributors ------------- - -* Firstname Lastname -* Second Person - -Funders -------- - -The development of this module has been financially supported by: - -* Company 1 name -* Company 2 name - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -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. - -To contribute to this module, please visit https://odoo-community.org. diff --git a/auth_api_key/readme/CONFIGURE.rst b/auth_api_key/readme/CONFIGURE.rst index 0c2c0538e..0d403e1f6 100644 --- a/auth_api_key/readme/CONFIGURE.rst +++ b/auth_api_key/readme/CONFIGURE.rst @@ -1,2 +1,8 @@ -The api key must be provided by the coniguration parameter named -'api_key_*.key', and the user under the same option 'api_key_*.user'. \ No newline at end of file +The api key must be provided by the configuration parameter named +'api_key_*.key', and the user under the same option 'api_key_*.user'. + +For instance : + + [api_key_mykey] + key=my_api_key + user=my_user \ No newline at end of file diff --git a/auth_api_key/readme/CONTRIBUTORS.rst b/auth_api_key/readme/CONTRIBUTORS.rst index 765b55149..14d8f94b8 100644 --- a/auth_api_key/readme/CONTRIBUTORS.rst +++ b/auth_api_key/readme/CONTRIBUTORS.rst @@ -1,4 +1,4 @@ -* Denis Robinet <> -* Laurent Mignon <> -* Quentin Groulard <> -* Sébastien Beau <> \ No newline at end of file +* Denis Robinet +* Laurent Mignon +* Quentin Groulard +* Sébastien Beau \ No newline at end of file diff --git a/auth_api_key/readme/DESCRIPTION.rst b/auth_api_key/readme/DESCRIPTION.rst index dd9562ef5..575f75544 100644 --- a/auth_api_key/readme/DESCRIPTION.rst +++ b/auth_api_key/readme/DESCRIPTION.rst @@ -1 +1,5 @@ -Authenticate http requests from an API key. \ No newline at end of file +Authenticate http requests from an API key. + +API keys are codes passed in (in the http header API-KEY) by programs calling an API in order to identify -in this case- the calling program's user. + +Take care while using this kind of mechanism since information into http headers are visible in clear. Thus, use it only to authenticate requests from known sources. For unknown sources, it is a good practice to filter out this header at proxy level. \ No newline at end of file From 8e4e467df220636f827b866ee757337910084c7b Mon Sep 17 00:00:00 2001 From: qgroulard <43472442+qgroulard@users.noreply.github.com> Date: Thu, 8 Nov 2018 11:22:06 +0100 Subject: [PATCH 011/138] Quick fix CONFIGURE.rst --- auth_api_key/readme/CONFIGURE.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth_api_key/readme/CONFIGURE.rst b/auth_api_key/readme/CONFIGURE.rst index 0d403e1f6..5118d0b93 100644 --- a/auth_api_key/readme/CONFIGURE.rst +++ b/auth_api_key/readme/CONFIGURE.rst @@ -2,7 +2,7 @@ The api key must be provided by the configuration parameter named 'api_key_*.key', and the user under the same option 'api_key_*.user'. For instance : - +:: [api_key_mykey] key=my_api_key - user=my_user \ No newline at end of file + user=my_user From 0307905e687d4bf71a405fbfd0b67ec874bd6c88 Mon Sep 17 00:00:00 2001 From: qgroulard <43472442+qgroulard@users.noreply.github.com> Date: Thu, 8 Nov 2018 11:32:09 +0100 Subject: [PATCH 012/138] Developmet status: Beta --- auth_api_key/__manifest__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/auth_api_key/__manifest__.py b/auth_api_key/__manifest__.py index 7b68da7c4..c0680ffcc 100644 --- a/auth_api_key/__manifest__.py +++ b/auth_api_key/__manifest__.py @@ -10,6 +10,7 @@ "license": "AGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://acsone.eu/", + "development_status": "Beta", "depends": ["server_environment"], "data": [], "demo": [], From f12ca09533c4a576f35f8a3abeab96a6f9a19321 Mon Sep 17 00:00:00 2001 From: "Laurent Mignon (ACSONE)" Date: Tue, 13 Nov 2018 11:32:39 +0100 Subject: [PATCH 013/138] [FIX] auth_api_key: fix api and flake8 --- auth_api_key/README.rst | 108 +++++ auth_api_key/models/auth_api_key.py | 12 +- auth_api_key/models/ir_http.py | 5 +- auth_api_key/readme/CONFIGURE.rst | 4 +- auth_api_key/readme/USAGE.rst | 3 +- auth_api_key/static/description/index.html | 449 +++++++++++++++++++++ auth_api_key/tests/test_auth_api_key.py | 15 +- 7 files changed, 581 insertions(+), 15 deletions(-) create mode 100644 auth_api_key/README.rst create mode 100644 auth_api_key/static/description/index.html diff --git a/auth_api_key/README.rst b/auth_api_key/README.rst new file mode 100644 index 000000000..cbdf2d6b2 --- /dev/null +++ b/auth_api_key/README.rst @@ -0,0 +1,108 @@ +============ +Auth Api Key +============ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github + :target: https://github.com/OCA/server-auth/tree/10.0/auth_api_key + :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-10-0/server-auth-10-0-auth_api_key + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/251/10.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Authenticate http requests from an API key. + +API keys are codes passed in (in the http header API-KEY) by programs calling an API in order to identify -in this case- the calling program's user. + +Take care while using this kind of mechanism since information into http headers are visible in clear. Thus, use it only to authenticate requests from known sources. For unknown sources, it is a good practice to filter out this header at proxy level. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +The api key must be provided by the configuration parameter named +'api_key_*.key', and the user under the same option 'api_key_*.user'. + +For instance : + +.. code-block:: ini + + [api_key_mykey] + key=my_api_key + user=my_user + +Usage +===== + +To apply this authentication system to your http request you must set 'api_key' +as value for the 'auth' parameter of your route definition into your controller. + +.. code-block:: python + + class MyController(Controller): + + @route('/my_service', auth='api_key', ...) + def my_service(self, *args, **kwargs): + pass + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ACSONE SA/NV + +Contributors +~~~~~~~~~~~~ + +* Denis Robinet +* Laurent Mignon +* Quentin Groulard +* Sébastien Beau + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 733bd10f0..4b8efd52d 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -2,7 +2,7 @@ # Copyright 2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, tools +from odoo import api, models, tools, _ from odoo.addons.server_environment import serv_config @@ -16,20 +16,22 @@ class AuthApiKey(models.TransientModel): @tools.ormcache("api_key") def _retrieve_uid_from_api_key(self, api_key): if not self.env.user.has_group("base.group_system"): - raise AccessError("User is not allowed") + raise AccessError(_("User is not allowed")) for section in serv_config.sections(): if section.startswith("api_key_") and serv_config.has_option( - section, "key" + section, "key" ): if api_key != serv_config.get(section, "key"): continue login_name = serv_config.get(section, "user") - uid = self.env["res.users"].search([("login", "=", login_name)]).id + uid = self.env["res.users"].search( + [("login", "=", login_name)]).id if not uid: - raise ValidationError("No user found with login %s" % login_name) + raise ValidationError( + _("No user found with login %s") % login_name) return uid return False diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py index dd1483a64..d79da075c 100644 --- a/auth_api_key/models/ir_http.py +++ b/auth_api_key/models/ir_http.py @@ -23,7 +23,8 @@ def _auth_method_api_key(cls): api_key = headers.get("HTTP_API_KEY") if api_key: request.uid = 1 - uid = request.env["auth.api.key"].retrieve_uid_from_api_key(api_key) + uid = request.env["auth.api.key"]._retrieve_uid_from_api_key( + api_key) if uid: # reset _env on the request since we change the uid... # the next call to env will instantiate an new @@ -31,7 +32,7 @@ def _auth_method_api_key(cls): # auth.api_key request._env = None request.uid = uid - request.auth_api_key = auth_api_key + request.auth_api_key = api_key return True _logger.error("Wrong HTTP_API_KEY, access denied") raise AccessDenied() diff --git a/auth_api_key/readme/CONFIGURE.rst b/auth_api_key/readme/CONFIGURE.rst index 5118d0b93..d65bfb4db 100644 --- a/auth_api_key/readme/CONFIGURE.rst +++ b/auth_api_key/readme/CONFIGURE.rst @@ -2,7 +2,9 @@ The api key must be provided by the configuration parameter named 'api_key_*.key', and the user under the same option 'api_key_*.user'. For instance : -:: + +.. code-block:: ini + [api_key_mykey] key=my_api_key user=my_user diff --git a/auth_api_key/readme/USAGE.rst b/auth_api_key/readme/USAGE.rst index 4464ca59c..d8ff4460e 100644 --- a/auth_api_key/readme/USAGE.rst +++ b/auth_api_key/readme/USAGE.rst @@ -1,9 +1,10 @@ To apply this authentication system to your http request you must set 'api_key' as value for the 'auth' parameter of your route definition into your controller. +.. code-block:: python class MyController(Controller): @route('/my_service', auth='api_key', ...) def my_service(self, *args, **kwargs): - pass \ No newline at end of file + pass diff --git a/auth_api_key/static/description/index.html b/auth_api_key/static/description/index.html new file mode 100644 index 000000000..c5d2d3198 --- /dev/null +++ b/auth_api_key/static/description/index.html @@ -0,0 +1,449 @@ + + + + + + +Auth Api Key + + + +
+

Auth Api Key

+ + +

Beta License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

Authenticate http requests from an API key.

+

API keys are codes passed in (in the http header API-KEY) by programs calling an API in order to identify -in this case- the calling program’s user.

+

Take care while using this kind of mechanism since information into http headers are visible in clear. Thus, use it only to authenticate requests from known sources. For unknown sources, it is a good practice to filter out this header at proxy level.

+

Table of contents

+ +
+

Configuration

+

The api key must be provided by the configuration parameter named +‘api_key_*.key’, and the user under the same option ‘api_key_*.user’.

+

For instance :

+
+[api_key_mykey]
+key=my_api_key
+user=my_user
+
+
+
+

Usage

+

To apply this authentication system to your http request you must set ‘api_key’ +as value for the ‘auth’ parameter of your route definition into your controller.

+
+class MyController(Controller):
+
+    @route('/my_service', auth='api_key', ...)
+    def my_service(self, *args, **kwargs):
+        pass
+
+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

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

+
+
+
+ + diff --git a/auth_api_key/tests/test_auth_api_key.py b/auth_api_key/tests/test_auth_api_key.py index dd43eb4f3..284a5aeba 100644 --- a/auth_api_key/tests/test_auth_api_key.py +++ b/auth_api_key/tests/test_auth_api_key.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase from odoo.addons.server_environment import serv_config from odoo.exceptions import ValidationError, AccessError @@ -18,18 +21,18 @@ def setUpClass(cls, *args, **kwargs): def test_lookup(self): demo_user = self.env.ref("base.user_demo") self.assertEqual( - self.env["auth.api.key"]._retrieve_uid_from_api_key("api_right_key"), + self.env["auth.api.key"]._retrieve_uid_from_api_key( + "api_right_key"), demo_user.id, ) def test_wrong_key(self): with self.assertRaises(ValidationError), self.env.cr.savepoint(): - self.env["auth.api.key"]._retrieve_uid_from_api_key("api_wrong_key") + self.env["auth.api.key"]._retrieve_uid_from_api_key( + "api_wrong_key") def test_user_not_allowed(self): demo_user = self.env.ref("base.user_demo") with self.assertRaises(AccessError), self.env.cr.savepoint(): - self.env["auth.api.key"].sudo(user=demo_user)._retrieve_uid_from_api_key( - "api_wrong_key" - ) - + self.env["auth.api.key"].sudo(user=demo_user).\ + _retrieve_uid_from_api_key("api_wrong_key") From 454a93f10c05c74269b81ce91a1324b4ff0476b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Tue, 20 Nov 2018 17:58:49 +0100 Subject: [PATCH 014/138] [MIG] server_auth from 10 to 12 --- auth_api_key/__manifest__.py | 2 +- auth_api_key/models/auth_api_key.py | 1 - auth_api_key/models/ir_http.py | 1 - auth_api_key/tests/test_auth_api_key.py | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/auth_api_key/__manifest__.py b/auth_api_key/__manifest__.py index c0680ffcc..ae027c031 100644 --- a/auth_api_key/__manifest__.py +++ b/auth_api_key/__manifest__.py @@ -6,7 +6,7 @@ "name": "Auth Api Key", "summary": """ Authenticate http requests from an API key""", - "version": "10.0.1.0.0", + "version": "12.0.1.0.0", "license": "AGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://acsone.eu/", diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 4b8efd52d..387073c62 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py index d79da075c..2a14cac38 100644 --- a/auth_api_key/models/ir_http.py +++ b/auth_api_key/models/ir_http.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2018 ACSONE SA/NV # Copyright 2017 Akretion (http://www.akretion.com). # @author Sébastien BEAU diff --git a/auth_api_key/tests/test_auth_api_key.py b/auth_api_key/tests/test_auth_api_key.py index 284a5aeba..0e3c7d9f8 100644 --- a/auth_api_key/tests/test_auth_api_key.py +++ b/auth_api_key/tests/test_auth_api_key.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2018 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase From 46e325139b5df5a9b1e7b8048fa6b97d5ddfb6cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Tue, 20 Nov 2018 19:22:57 +0100 Subject: [PATCH 015/138] auth_api_key: add description to model --- auth_api_key/models/auth_api_key.py | 1 + 1 file changed, 1 insertion(+) diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 387073c62..b302d2da5 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -10,6 +10,7 @@ class AuthApiKey(models.TransientModel): _name = "auth.api.key" + _description = "API Key Retriever" @api.model @tools.ormcache("api_key") From ea150e8e7fc202ee86e292a118f8818829f75994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Wed, 21 Nov 2018 11:07:12 +0100 Subject: [PATCH 016/138] [CHG] auth_api_key is LGPL --- auth_api_key/__manifest__.py | 4 ++-- auth_api_key/models/auth_api_key.py | 2 +- auth_api_key/models/ir_http.py | 2 +- auth_api_key/tests/test_auth_api_key.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/auth_api_key/__manifest__.py b/auth_api_key/__manifest__.py index ae027c031..896e30b8a 100644 --- a/auth_api_key/__manifest__.py +++ b/auth_api_key/__manifest__.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- # Copyright 2018 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { "name": "Auth Api Key", "summary": """ Authenticate http requests from an API key""", "version": "12.0.1.0.0", - "license": "AGPL-3", + "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://acsone.eu/", "development_status": "Beta", diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index b302d2da5..b39735f2c 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -1,5 +1,5 @@ # Copyright 2018 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). from odoo import api, models, tools, _ diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py index 2a14cac38..1e6638a07 100644 --- a/auth_api_key/models/ir_http.py +++ b/auth_api_key/models/ir_http.py @@ -1,7 +1,7 @@ # Copyright 2018 ACSONE SA/NV # Copyright 2017 Akretion (http://www.akretion.com). # @author Sébastien BEAU -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). import logging diff --git a/auth_api_key/tests/test_auth_api_key.py b/auth_api_key/tests/test_auth_api_key.py index 0e3c7d9f8..a187aed1b 100644 --- a/auth_api_key/tests/test_auth_api_key.py +++ b/auth_api_key/tests/test_auth_api_key.py @@ -1,5 +1,5 @@ # Copyright 2018 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). from odoo.tests.common import TransactionCase from odoo.addons.server_environment import serv_config from odoo.exceptions import ValidationError, AccessError From 4c2af8e26c46b6f4873aa761b71ac58af348ad6f Mon Sep 17 00:00:00 2001 From: Andreas Perhab <38032588+ap-wtioit@users.noreply.github.com> Date: Fri, 30 Nov 2018 11:23:10 +0100 Subject: [PATCH 017/138] Use consteq to compare keys Co-Authored-By: qgroulard <43472442+qgroulard@users.noreply.github.com> --- auth_api_key/models/auth_api_key.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index b39735f2c..1c435a09f 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -4,6 +4,7 @@ from odoo import api, models, tools, _ from odoo.addons.server_environment import serv_config +from odoo.tools import consteq from odoo.exceptions import ValidationError, AccessError @@ -22,7 +23,7 @@ def _retrieve_uid_from_api_key(self, api_key): if section.startswith("api_key_") and serv_config.has_option( section, "key" ): - if api_key != serv_config.get(section, "key"): + if not consteq(api_key, serv_config.get(section, "key")): continue login_name = serv_config.get(section, "user") From 02ca732aa037322520da8abe73401dc51d55e176 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 14 Feb 2019 10:29:14 +0000 Subject: [PATCH 018/138] [UPD] README.rst --- auth_api_key/README.rst | 16 ++++++++-------- auth_api_key/static/description/index.html | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/auth_api_key/README.rst b/auth_api_key/README.rst index cbdf2d6b2..dc5e5bc24 100644 --- a/auth_api_key/README.rst +++ b/auth_api_key/README.rst @@ -10,17 +10,17 @@ Auth Api Key .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 +.. |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/10.0/auth_api_key + :target: https://github.com/OCA/server-auth/tree/12.0/auth_api_key :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-10-0/server-auth-10-0-auth_api_key + :target: https://translation.odoo-community.org/projects/server-auth-12-0/server-auth-12-0-auth_api_key :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/251/10.0 + :target: https://runbot.odoo-community.org/runbot/251/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -70,7 +70,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. @@ -103,6 +103,6 @@ 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 `_ project on GitHub. +This module is part of the `OCA/server-auth `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auth_api_key/static/description/index.html b/auth_api_key/static/description/index.html index c5d2d3198..f70369a5a 100644 --- a/auth_api_key/static/description/index.html +++ b/auth_api_key/static/description/index.html @@ -367,7 +367,7 @@

Auth Api Key

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

Beta License: AGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

Authenticate http requests from an API key.

API keys are codes passed in (in the http header API-KEY) by programs calling an API in order to identify -in this case- the calling program’s user.

Take care while using this kind of mechanism since information into http headers are visible in clear. Thus, use it only to authenticate requests from known sources. For unknown sources, it is a good practice to filter out this header at proxy level.

@@ -413,7 +413,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.

@@ -440,7 +440,7 @@

Maintainers

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 project on GitHub.

+

This module is part of the OCA/server-auth project on GitHub.

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

From 7be81bfeab311100d1d0b48180300d0a1287a778 Mon Sep 17 00:00:00 2001 From: Mourad Date: Thu, 18 Jul 2019 13:47:24 +0200 Subject: [PATCH 019/138] [IMP] ADD possibility to save api keys in database by using server.env.mixin obj --- auth_api_key/models/auth_api_key.py | 62 +++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 1c435a09f..8059bd304 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -3,36 +3,64 @@ from odoo import api, models, tools, _ -from odoo.addons.server_environment import serv_config from odoo.tools import consteq from odoo.exceptions import ValidationError, AccessError -class AuthApiKey(models.TransientModel): +class AuthApiKey(models.Model): _name = "auth.api.key" + _inherit = "server.env.mixin" _description = "API Key Retriever" + name = fields.Char(required=True) + key = fields.Char(required=True) + user = fields.Char(required=True) + + _sql_constraints = [ + ('key_uniq', 'unique(key)', 'API Key Retriever must be unique !'), + ] + + @property + def _server_env_fields(self): + base_fields = super()._server_env_fields + api_key_fields = { + "key": {}, + "user": {}, + } + api_key_fields.update(base_fields) + return api_key_fields + @api.model @tools.ormcache("api_key") - def _retrieve_uid_from_api_key(self, api_key): + def _retrieve_api_key(self, api_key): if not self.env.user.has_group("base.group_system"): raise AccessError(_("User is not allowed")) + ap_keys = self.search([]) + # api key are a computed field in the context of server env + # so we can't use a domain in search method + key = False + for ap_key in ap_keys: + if consteq(api_key, ap_key.key): + key = ap_key + + if not key: + raise ValidationError( + _("The key %s is not defined") % api_key) - for section in serv_config.sections(): - if section.startswith("api_key_") and serv_config.has_option( - section, "key" - ): - if not consteq(api_key, serv_config.get(section, "key")): - continue + return key + + @api.model + @tools.ormcache("api_key") + def _retrieve_uid_from_api_key(self, api_key): + ap_key = self._retrieve_api_key(api_key) + uid = self.env["res.users"].search( + [("login", "=", ap_key.user)]).id - login_name = serv_config.get(section, "user") - uid = self.env["res.users"].search( - [("login", "=", login_name)]).id + if not uid: + raise ValidationError( + _("No user found with login %s") % login_name) - if not uid: - raise ValidationError( - _("No user found with login %s") % login_name) + return uid + return False - return uid - return False From 74dbb2c5635ff6bfc202261f4a78e9df390a5057 Mon Sep 17 00:00:00 2001 From: Mourad Date: Thu, 18 Jul 2019 13:52:33 +0200 Subject: [PATCH 020/138] [FIX] login_name error --- auth_api_key/models/auth_api_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index 8059bd304..e767ff833 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -59,7 +59,7 @@ def _retrieve_uid_from_api_key(self, api_key): if not uid: raise ValidationError( - _("No user found with login %s") % login_name) + _("No user found with login %s") % ap_key.user) return uid return False From c6109aabd0b31d52e94e9f5f57a83a897499de2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Fri, 19 Jul 2019 17:13:54 +0200 Subject: [PATCH 021/138] [IMP] make auth_api_key compatible in multi-db Api key is now based on the new version of server env Key belong to a specifiv database that can be requested based on the domain name. Just setup the db_filter with "%d^" to filter based on domain name --- auth_api_key/__manifest__.py | 2 +- auth_api_key/models/auth_api_key.py | 64 +++++++++++------------ auth_api_key/models/ir_http.py | 8 +-- auth_api_key/security/ir.model.access.csv | 2 + 4 files changed, 39 insertions(+), 37 deletions(-) create mode 100644 auth_api_key/security/ir.model.access.csv diff --git a/auth_api_key/__manifest__.py b/auth_api_key/__manifest__.py index 896e30b8a..c75d1f01c 100644 --- a/auth_api_key/__manifest__.py +++ b/auth_api_key/__manifest__.py @@ -12,6 +12,6 @@ "website": "https://acsone.eu/", "development_status": "Beta", "depends": ["server_environment"], - "data": [], + "data": ['security/ir.model.access.csv'], "demo": [], } diff --git a/auth_api_key/models/auth_api_key.py b/auth_api_key/models/auth_api_key.py index e767ff833..df979551d 100644 --- a/auth_api_key/models/auth_api_key.py +++ b/auth_api_key/models/auth_api_key.py @@ -1,7 +1,7 @@ # Copyright 2018 ACSONE SA/NV # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from odoo import api, models, tools, _ +from odoo import api, fields, models, tools, _ from odoo.tools import consteq @@ -15,52 +15,52 @@ class AuthApiKey(models.Model): name = fields.Char(required=True) key = fields.Char(required=True) - user = fields.Char(required=True) - - _sql_constraints = [ - ('key_uniq', 'unique(key)', 'API Key Retriever must be unique !'), - ] + user_id = fields.Many2one( + comodel_name="res.users", + string="User", + required=True) @property def _server_env_fields(self): base_fields = super()._server_env_fields api_key_fields = { "key": {}, - "user": {}, } api_key_fields.update(base_fields) return api_key_fields @api.model - @tools.ormcache("api_key") - def _retrieve_api_key(self, api_key): + def _retrieve_api_key(self, key): + return self.browse(self._retrieve_api_key_id(key)) + + @api.model + @tools.ormcache("key") + def _retrieve_api_key_id(self, key): if not self.env.user.has_group("base.group_system"): raise AccessError(_("User is not allowed")) - ap_keys = self.search([]) - # api key are a computed field in the context of server env - # so we can't use a domain in search method - key = False - for ap_key in ap_keys: - if consteq(api_key, ap_key.key): - key = ap_key - - if not key: - raise ValidationError( - _("The key %s is not defined") % api_key) - - return key + for api_key in self.search([]): + if consteq(key, api_key.key): + return api_key.id + raise ValidationError(_("The key %s is not allowed") % key) @api.model - @tools.ormcache("api_key") - def _retrieve_uid_from_api_key(self, api_key): - ap_key = self._retrieve_api_key(api_key) - uid = self.env["res.users"].search( - [("login", "=", ap_key.user)]).id + @tools.ormcache("key") + def _retrieve_uid_from_api_key(self, key): + return self._retrieve_api_key(key).user_id.id - if not uid: - raise ValidationError( - _("No user found with login %s") % ap_key.user) + def _clear_key_cache(self): + self._retrieve_api_key_id.clear_cache() + self._retrieve_uid_from_api_key.clear_cache() - return uid - return False + @api.model + def create(self, vals): + record = super(AuthApikey, self).create(vals) + if 'key' in vals: + self._clear_key_cache() + return record + def write(self, vals): + super(AuthApikey, self).write(vals) + if 'key' in vals: + self._clear_key_cache() + return True diff --git a/auth_api_key/models/ir_http.py b/auth_api_key/models/ir_http.py index 1e6638a07..f28183abb 100644 --- a/auth_api_key/models/ir_http.py +++ b/auth_api_key/models/ir_http.py @@ -22,16 +22,16 @@ def _auth_method_api_key(cls): api_key = headers.get("HTTP_API_KEY") if api_key: request.uid = 1 - uid = request.env["auth.api.key"]._retrieve_uid_from_api_key( - api_key) - if uid: + api = request.env["auth.api.key"]._retrieve_api_key(api_key) + if api: # reset _env on the request since we change the uid... # the next call to env will instantiate an new # odoo.api.Environment with the user defined on the # auth.api_key request._env = None - request.uid = uid + request.uid = api.user_id.id request.auth_api_key = api_key + request.auth_api_key_id = api.id return True _logger.error("Wrong HTTP_API_KEY, access denied") raise AccessDenied() diff --git a/auth_api_key/security/ir.model.access.csv b/auth_api_key/security/ir.model.access.csv new file mode 100644 index 000000000..b964d8c1d --- /dev/null +++ b/auth_api_key/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_auth_api_key,access_auth_api_key,model_auth_api_key,base.group_system,1,1,1,1 From ab5095caec98a07d8814d3128c337c2c645a03fb Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 29 Jul 2019 03:37:25 +0000 Subject: [PATCH 022/138] [UPD] README.rst --- auth_api_key/static/description/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_api_key/static/description/index.html b/auth_api_key/static/description/index.html index f70369a5a..8a5bd04ca 100644 --- a/auth_api_key/static/description/index.html +++ b/auth_api_key/static/description/index.html @@ -3,7 +3,7 @@ - + Auth Api Key + + +
+

Auth API key server environment

+ + +

Alpha License: LGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

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:

+
+[api_key_<Record Name>]
+key=my_api_key
+
+
+

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

+
+

Table of contents

+ +
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

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

+
+
+
+ + diff --git a/auth_api_key_server_env/tests/__init__.py b/auth_api_key_server_env/tests/__init__.py new file mode 100644 index 000000000..56e3e32a3 --- /dev/null +++ b/auth_api_key_server_env/tests/__init__.py @@ -0,0 +1 @@ +from . import test_auth_api_key diff --git a/auth_api_key_server_env/tests/test_auth_api_key.py b/auth_api_key_server_env/tests/test_auth_api_key.py new file mode 100644 index 000000000..e533c0a99 --- /dev/null +++ b/auth_api_key_server_env/tests/test_auth_api_key.py @@ -0,0 +1,32 @@ +# Copyright 2018 ACSONE SA/NV +# Copyright 2021 Camptocamp SA +# @author: Simone Orsi +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +from odoo.exceptions import ValidationError +from odoo.tests.common import SavepointCase + +from odoo.addons.server_environment import serv_config + + +class TestAuthApiKey(SavepointCase): + @classmethod + def setUpClass(cls, *args, **kwargs): + super().setUpClass(*args, **kwargs) + cls.AuthApiKey = cls.env["auth.api.key"] + cls.demo_user = cls.env.ref("base.user_demo") + cls.api_key_from_env = cls.AuthApiKey.create( + {"name": "from_env", "key": "dummy", "user_id": cls.demo_user.id} + ) + cls.api_key_from_env.refresh() + serv_config.add_section("api_key_from_env") + serv_config.set("api_key_from_env", "key", "api_key_from_env") + + def test_lookup_key_from_env(self): + self.assertEqual( + self.env["auth.api.key"]._retrieve_uid_from_api_key("api_key_from_env"), + self.demo_user.id, + ) + with self.assertRaises(ValidationError): + # dummy key must be replace with the one from env and + # therefore should be unusable + self.env["auth.api.key"]._retrieve_uid_from_api_key("dummy") From 2829d74f4b741612d887d9bb6831043c8639fc73 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 27 Sep 2021 08:24:46 +0000 Subject: [PATCH 069/138] [ADD] icon.png --- .../static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 auth_api_key_server_env/static/description/icon.png diff --git a/auth_api_key_server_env/static/description/icon.png b/auth_api_key_server_env/static/description/icon.png new file mode 100644 index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PATCH 070/138] auth_api_key_server_env 14.0.1.0.1 --- auth_api_key_server_env/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_api_key_server_env/__manifest__.py b/auth_api_key_server_env/__manifest__.py index df51a909c..3e7c7f029 100644 --- a/auth_api_key_server_env/__manifest__.py +++ b/auth_api_key_server_env/__manifest__.py @@ -11,7 +11,7 @@ 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": "14.0.1.0.0", + "version": "14.0.1.0.1", "development_status": "Alpha", "license": "LGPL-3", "website": "https://github.com/OCA/server-auth", From 5e69ef601ca56e97dabfeab70218258327e6960f Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Fri, 26 Nov 2021 18:21:08 +0200 Subject: [PATCH 071/138] [MIG] auth_api_key_server_env: Migration to 15.0 --- auth_api_key_server_env/README.rst | 10 +++++----- auth_api_key_server_env/__manifest__.py | 2 +- .../i18n/auth_api_key_server_env.pot | 2 +- auth_api_key_server_env/static/description/index.html | 6 +++--- auth_api_key_server_env/tests/test_auth_api_key.py | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/auth_api_key_server_env/README.rst b/auth_api_key_server_env/README.rst index ae726190f..605a2b9d9 100644 --- a/auth_api_key_server_env/README.rst +++ b/auth_api_key_server_env/README.rst @@ -14,13 +14,13 @@ Auth API key server environment :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/14.0/auth_api_key_server_env + :target: https://github.com/OCA/server-auth/tree/15.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-14-0/server-auth-14-0-auth_api_key_server_env + :target: https://translation.odoo-community.org/projects/server-auth-15-0/server-auth-15-0-auth_api_key_server_env :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/251/14.0 + :target: https://runbot.odoo-community.org/runbot/251/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -52,7 +52,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. @@ -82,6 +82,6 @@ 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 `_ project on GitHub. +This module is part of the `OCA/server-auth `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auth_api_key_server_env/__manifest__.py b/auth_api_key_server_env/__manifest__.py index 3e7c7f029..fc221d619 100644 --- a/auth_api_key_server_env/__manifest__.py +++ b/auth_api_key_server_env/__manifest__.py @@ -11,7 +11,7 @@ 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": "14.0.1.0.1", + "version": "15.0.1.0.0", "development_status": "Alpha", "license": "LGPL-3", "website": "https://github.com/OCA/server-auth", diff --git a/auth_api_key_server_env/i18n/auth_api_key_server_env.pot b/auth_api_key_server_env/i18n/auth_api_key_server_env.pot index 8165ada55..a079a8c7f 100644 --- a/auth_api_key_server_env/i18n/auth_api_key_server_env.pot +++ b/auth_api_key_server_env/i18n/auth_api_key_server_env.pot @@ -4,7 +4,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/auth_api_key_server_env/static/description/index.html b/auth_api_key_server_env/static/description/index.html index b7eb6a720..843968400 100644 --- a/auth_api_key_server_env/static/description/index.html +++ b/auth_api_key_server_env/static/description/index.html @@ -367,7 +367,7 @@

Auth API key server environment

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

Alpha License: LGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

Alpha License: LGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

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 @@ -399,7 +399,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.

@@ -423,7 +423,7 @@

Maintainers

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 project on GitHub.

+

This module is part of the OCA/server-auth project on GitHub.

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

diff --git a/auth_api_key_server_env/tests/test_auth_api_key.py b/auth_api_key_server_env/tests/test_auth_api_key.py index e533c0a99..4121cc3a5 100644 --- a/auth_api_key_server_env/tests/test_auth_api_key.py +++ b/auth_api_key_server_env/tests/test_auth_api_key.py @@ -3,12 +3,12 @@ # @author: Simone Orsi # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). from odoo.exceptions import ValidationError -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase from odoo.addons.server_environment import serv_config -class TestAuthApiKey(SavepointCase): +class TestAuthApiKey(TransactionCase): @classmethod def setUpClass(cls, *args, **kwargs): super().setUpClass(*args, **kwargs) From 35e5b2055a8e29689740b6ac017f717e70bd275a Mon Sep 17 00:00:00 2001 From: oca-ci Date: Tue, 30 Nov 2021 14:47:52 +0000 Subject: [PATCH 072/138] [UPD] Update auth_api_key_server_env.pot --- .../i18n/auth_api_key_server_env.pot | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/auth_api_key_server_env/i18n/auth_api_key_server_env.pot b/auth_api_key_server_env/i18n/auth_api_key_server_env.pot index a079a8c7f..c9ac92d62 100644 --- a/auth_api_key_server_env/i18n/auth_api_key_server_env.pot +++ b/auth_api_key_server_env/i18n/auth_api_key_server_env.pot @@ -18,21 +18,6 @@ msgstr "" 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__display_name -msgid "Display Name" -msgstr "" - -#. module: auth_api_key_server_env -#: model:ir.model.fields,field_description:auth_api_key_server_env.field_auth_api_key__id -msgid "ID" -msgstr "" - -#. module: auth_api_key_server_env -#: model:ir.model.fields,field_description:auth_api_key_server_env.field_auth_api_key____last_update -msgid "Last Modified on" -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" From a0cae973f046aad482b94fe4c4ea60f870e6157b Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 30 Dec 2022 16:10:11 +0100 Subject: [PATCH 073/138] [16.0][MIG] Migrate auth_api_key_server_env to v16 --- auth_api_key_server_env/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth_api_key_server_env/__manifest__.py b/auth_api_key_server_env/__manifest__.py index fc221d619..9a178dc89 100644 --- a/auth_api_key_server_env/__manifest__.py +++ b/auth_api_key_server_env/__manifest__.py @@ -11,7 +11,7 @@ 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": "15.0.1.0.0", + "version": "16.0.1.0.0", "development_status": "Alpha", "license": "LGPL-3", "website": "https://github.com/OCA/server-auth", From 4575bc1d5c6a1f4092476af7b9da2ce51b792f98 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Fri, 8 Sep 2023 13:52:51 +0200 Subject: [PATCH 074/138] [IMP] auth_api_key_server_env: use tech_name --- .../migrations/16.0.1.0.0/post-migration.py | 10 ++++++++++ auth_api_key_server_env/models/auth_api_key.py | 7 ++----- auth_api_key_server_env/readme/CONTRIBUTORS.rst | 1 + auth_api_key_server_env/readme/DESCRIPTION.rst | 2 +- auth_api_key_server_env/tests/test_auth_api_key.py | 11 ++++++++--- 5 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 auth_api_key_server_env/migrations/16.0.1.0.0/post-migration.py diff --git a/auth_api_key_server_env/migrations/16.0.1.0.0/post-migration.py b/auth_api_key_server_env/migrations/16.0.1.0.0/post-migration.py new file mode 100644 index 000000000..e590eae6f --- /dev/null +++ b/auth_api_key_server_env/migrations/16.0.1.0.0/post-migration.py @@ -0,0 +1,10 @@ +from odoo import SUPERUSER_ID, api + + +def migrate(cr, version): + env = api.Environment(cr, SUPERUSER_ID, {}) + keys = env["auth.api.key"].search( + [("tech_name", "=", False), ("name", "!=", False)] + ) + for key in keys: + key.write({"tech_name": key._normalize_tech_name(key.name)}) diff --git a/auth_api_key_server_env/models/auth_api_key.py b/auth_api_key_server_env/models/auth_api_key.py index baabfde16..4e30d8101 100644 --- a/auth_api_key_server_env/models/auth_api_key.py +++ b/auth_api_key_server_env/models/auth_api_key.py @@ -10,20 +10,17 @@ class AuthApiKey(models.Model): _name = "auth.api.key" - _inherit = ["auth.api.key", "server.env.mixin"] + _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 "api_key_{}".format(self.name) + return "api_key_{}".format(getattr(self, self._server_env_section_name_field)) @property def _server_env_fields(self): diff --git a/auth_api_key_server_env/readme/CONTRIBUTORS.rst b/auth_api_key_server_env/readme/CONTRIBUTORS.rst index f1c71bce1..bf905a1e0 100644 --- a/auth_api_key_server_env/readme/CONTRIBUTORS.rst +++ b/auth_api_key_server_env/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Simone Orsi +* Florian da Costa diff --git a/auth_api_key_server_env/readme/DESCRIPTION.rst b/auth_api_key_server_env/readme/DESCRIPTION.rst index 1dc7bf00a..a1f43f857 100644 --- a/auth_api_key_server_env/readme/DESCRIPTION.rst +++ b/auth_api_key_server_env/readme/DESCRIPTION.rst @@ -6,5 +6,5 @@ section to your configuration file according to the following convention: .. code-block:: ini - [api_key_] + [api_key_] key=my_api_key diff --git a/auth_api_key_server_env/tests/test_auth_api_key.py b/auth_api_key_server_env/tests/test_auth_api_key.py index 4121cc3a5..cded35ecd 100644 --- a/auth_api_key_server_env/tests/test_auth_api_key.py +++ b/auth_api_key_server_env/tests/test_auth_api_key.py @@ -15,11 +15,16 @@ def setUpClass(cls, *args, **kwargs): cls.AuthApiKey = cls.env["auth.api.key"] cls.demo_user = cls.env.ref("base.user_demo") cls.api_key_from_env = cls.AuthApiKey.create( - {"name": "from_env", "key": "dummy", "user_id": cls.demo_user.id} + { + "name": "From Env", + "key": "dummy", + "user_id": cls.demo_user.id, + "tech_name": "test_env", + } ) cls.api_key_from_env.refresh() - serv_config.add_section("api_key_from_env") - serv_config.set("api_key_from_env", "key", "api_key_from_env") + serv_config.add_section("api_key_test_env") + serv_config.set("api_key_test_env", "key", "api_key_from_env") def test_lookup_key_from_env(self): self.assertEqual( From 6aefc6d14933105d0e80f28c0ef8cbd664d63a57 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Sat, 9 Sep 2023 13:46:29 +0000 Subject: [PATCH 075/138] [UPD] Update auth_api_key_server_env.pot --- .../i18n/auth_api_key_server_env.pot | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/auth_api_key_server_env/i18n/auth_api_key_server_env.pot b/auth_api_key_server_env/i18n/auth_api_key_server_env.pot index c9ac92d62..09a9616d7 100644 --- a/auth_api_key_server_env/i18n/auth_api_key_server_env.pot +++ b/auth_api_key_server_env/i18n/auth_api_key_server_env.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -22,3 +22,13 @@ msgstr "" #: 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 "" From 4a206b1c28c565db3e615675f992a1beee76a3d1 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sat, 9 Sep 2023 13:49:45 +0000 Subject: [PATCH 076/138] [UPD] README.rst --- auth_api_key_server_env/README.rst | 26 ++++++----- .../static/description/index.html | 43 ++++++++++--------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/auth_api_key_server_env/README.rst b/auth_api_key_server_env/README.rst index 605a2b9d9..00d59120d 100644 --- a/auth_api_key_server_env/README.rst +++ b/auth_api_key_server_env/README.rst @@ -2,10 +2,13 @@ Auth API key server environment =============================== -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:7b7d72b7fe47a8aad3083f27767d93c4b0d78764c3faf6304d8ad2756ba201bf + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png :target: https://odoo-community.org/page/development-status @@ -14,16 +17,16 @@ Auth API key server environment :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/15.0/auth_api_key_server_env + :target: https://github.com/OCA/server-auth/tree/16.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-15-0/server-auth-15-0-auth_api_key_server_env + :target: https://translation.odoo-community.org/projects/server-auth-16-0/server-auth-16-0-auth_api_key_server_env :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/251/15.0 - :alt: Try me on Runbot +.. |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=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| Configure api keys via server env. @@ -33,7 +36,7 @@ section to your configuration file according to the following convention: .. code-block:: ini - [api_key_] + [api_key_] key=my_api_key .. IMPORTANT:: @@ -51,8 +54,8 @@ 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 `_. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -68,6 +71,7 @@ Contributors ~~~~~~~~~~~~ * Simone Orsi +* Florian da Costa Maintainers ~~~~~~~~~~~ @@ -82,6 +86,6 @@ 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 `_ project on GitHub. +This module is part of the `OCA/server-auth `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/auth_api_key_server_env/static/description/index.html b/auth_api_key_server_env/static/description/index.html index 843968400..d3c23db37 100644 --- a/auth_api_key_server_env/static/description/index.html +++ b/auth_api_key_server_env/static/description/index.html @@ -1,20 +1,20 @@ - + - + Auth API key server environment + + +
+

User’s Log Viewer

+ + +

Production/Stable License: LGPL-3 OCA/server-auth Translate me on Weblate Try me on Runbot

+

This module adds a smart button on user’s form to display authentication logs.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Settings
  2. +
  3. Go to Users & Companies
  4. +
  5. Choose the User whose logs you need to see and go to Authentication logs
  6. +
  7. You will see a list of authentications for a specific user
  8. +
+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • IT-Projects LLC
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

trojikman

+

This module is part of the OCA/server-auth project on GitHub.

+

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

+
+
+
+ + From c04777c69b30b940ff8db619ccffe3260eb0c869 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 29 May 2020 13:55:54 +0000 Subject: [PATCH 087/138] [ADD] icon.png --- user_log_view/static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 user_log_view/static/description/icon.png diff --git a/user_log_view/static/description/icon.png b/user_log_view/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#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e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From 9871271365ec14cda54e708f4a7c392571b083be Mon Sep 17 00:00:00 2001 From: oca-travis Date: Mon, 30 Nov 2020 15:49:35 +0000 Subject: [PATCH 088/138] [UPD] Update user_log_view.pot --- user_log_view/i18n/user_log_view.pot | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 user_log_view/i18n/user_log_view.pot diff --git a/user_log_view/i18n/user_log_view.pot b/user_log_view/i18n/user_log_view.pot new file mode 100644 index 000000000..2c516c980 --- /dev/null +++ b/user_log_view/i18n/user_log_view.pot @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * user_log_view +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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: user_log_view +#: model:ir.actions.act_window,name:user_log_view.action_user_log +#: model_terms:ir.ui.view,arch_db:user_log_view.res_users_view_form +msgid "Authentication logs" +msgstr "" + +#. module: user_log_view +#: model_terms:ir.ui.view,arch_db:user_log_view.res_users_log_view_search +msgid "Date" +msgstr "" + +#. module: user_log_view +#: model_terms:ir.ui.view,arch_db:user_log_view.res_users_log_view_search +msgid "Group By" +msgstr "" + +#. module: user_log_view +#: model_terms:ir.ui.view,arch_db:user_log_view.res_users_log_view_search +msgid "Test Search" +msgstr "" + From 1e295e444585f9f8ded52ae1aa68db40adab3bac Mon Sep 17 00:00:00 2001 From: Chandresh Thakkar Date: Wed, 10 Feb 2021 18:27:05 +0530 Subject: [PATCH 089/138] [MIG] Module migration in v14. --- user_log_view/README.rst | 12 +++++----- user_log_view/__manifest__.py | 2 +- user_log_view/readme/CONTRIBUTORS.rst | 1 + user_log_view/views/res_users_views.xml | 30 ++++++++++++++++--------- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/user_log_view/README.rst b/user_log_view/README.rst index a2add2a9a..07d15c275 100644 --- a/user_log_view/README.rst +++ b/user_log_view/README.rst @@ -14,13 +14,13 @@ User's Log Viewer :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/12.0/user_log_view + :target: https://github.com/OCA/server-auth/tree/14.0/user_log_view :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-12-0/server-auth-12-0-user_log_view + :target: https://translation.odoo-community.org/projects/server-auth-14-0/server-auth-14-0-user_log_view :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/251/12.0 + :target: https://runbot.odoo-community.org/runbot/251/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -48,7 +48,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. @@ -64,6 +64,8 @@ Contributors ~~~~~~~~~~~~ * Denis Mudarisov (https://www.it-projects.info/) +* Chandresh Thakkar + Maintainers ~~~~~~~~~~~ @@ -86,6 +88,6 @@ Current `maintainer `__: |maintainer-trojikman| -This module is part of the `OCA/server-auth `_ project on GitHub. +This module is part of the `OCA/server-auth `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/user_log_view/__manifest__.py b/user_log_view/__manifest__.py index 165bd2ac6..6e1fe3f53 100644 --- a/user_log_view/__manifest__.py +++ b/user_log_view/__manifest__.py @@ -3,7 +3,7 @@ { "name": "User's Log Viewer", "summary": "Allow to see user's actions log", - "version": "12.0.1.0.0", + "version": "14.0.1.0.0", "development_status": "Production/Stable", "category": "Extra Tools", "website": "https://github.com/OCA/server-auth", diff --git a/user_log_view/readme/CONTRIBUTORS.rst b/user_log_view/readme/CONTRIBUTORS.rst index 92972c6da..4a18ad1cb 100644 --- a/user_log_view/readme/CONTRIBUTORS.rst +++ b/user_log_view/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Denis Mudarisov (https://www.it-projects.info/) +* Chandresh Thakkar diff --git a/user_log_view/views/res_users_views.xml b/user_log_view/views/res_users_views.xml index c90cd63bf..e87a35940 100644 --- a/user_log_view/views/res_users_views.xml +++ b/user_log_view/views/res_users_views.xml @@ -1,7 +1,6 @@ - + - @@ -19,10 +18,14 @@ res.users.log - - + + - + @@ -31,10 +34,15 @@ res.users.view.form res.users - + -