From 1f7598ba91213ae4c594ab178517f7de290434ed Mon Sep 17 00:00:00 2001 From: Dave Lasley Date: Thu, 20 Oct 2016 14:23:39 -0700 Subject: [PATCH] [MIG] password_security: Migrate to v10 * Bump versions * Installable to True * Add Usage section to ReadMe w/ Runbot link * `_crypt_context` now directly exposes the `CryptContext` * Change all instances of openerp to odoo --- password_security/README.rst | 10 ++++++++++ password_security/__manifest__.py | 4 ++-- password_security/controllers/main.py | 8 ++++---- password_security/exceptions.py | 2 +- password_security/models/res_company.py | 2 +- password_security/models/res_users.py | 4 ++-- password_security/models/res_users_pass_history.py | 2 +- password_security/tests/test_password_security_home.py | 6 +++--- .../tests/test_password_security_session.py | 4 ++-- password_security/tests/test_res_users.py | 2 +- 10 files changed, 27 insertions(+), 17 deletions(-) diff --git a/password_security/README.rst b/password_security/README.rst index 842bd4e90..483ae01fb 100644 --- a/password_security/README.rst +++ b/password_security/README.rst @@ -47,6 +47,16 @@ These are defined at the company level: password_minimum 24 Amount of hours that must pass until another reset ===================== ======= =================================================== +Usage +===== + +Configure using above instructions for each company that should have password +security mandates. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/149/10.0 + Known Issues / Roadmap ====================== diff --git a/password_security/__manifest__.py b/password_security/__manifest__.py index 0777063a7..8dd2727d2 100644 --- a/password_security/__manifest__.py +++ b/password_security/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Password Security', "summary": "Allow admin to set password security requirements.", - 'version': '9.0.1.0.2', + 'version': '10.0.1.0.0', 'author': "LasLabs, Odoo Community Association (OCA)", 'category': 'Base', 'depends': [ @@ -19,5 +19,5 @@ 'security/ir.model.access.csv', 'security/res_users_pass_history.xml', ], - 'installable': False, + 'installable': True, } diff --git a/password_security/controllers/main.py b/password_security/controllers/main.py index 23580628d..71df4ff66 100644 --- a/password_security/controllers/main.py +++ b/password_security/controllers/main.py @@ -4,10 +4,10 @@ import operator -from openerp import http -from openerp.http import request -from openerp.addons.auth_signup.controllers.main import AuthSignupHome -from openerp.addons.web.controllers.main import ensure_db, Session +from odoo import http +from odoo.http import request +from odoo.addons.auth_signup.controllers.main import AuthSignupHome +from odoo.addons.web.controllers.main import ensure_db, Session from ..exceptions import PassError diff --git a/password_security/exceptions.py b/password_security/exceptions.py index dbba100dc..eee568fa3 100644 --- a/password_security/exceptions.py +++ b/password_security/exceptions.py @@ -2,7 +2,7 @@ # Copyright 2015 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -from openerp.exceptions import Warning as UserError +from odoo.exceptions import Warning as UserError class PassError(UserError): diff --git a/password_security/models/res_company.py b/password_security/models/res_company.py index 03f00b2de..c9291635e 100644 --- a/password_security/models/res_company.py +++ b/password_security/models/res_company.py @@ -2,7 +2,7 @@ # Copyright 2015 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -from openerp import models, fields +from odoo import models, fields class ResCompany(models.Model): diff --git a/password_security/models/res_users.py b/password_security/models/res_users.py index 63b1fb3d6..53d88a30c 100644 --- a/password_security/models/res_users.py +++ b/password_security/models/res_users.py @@ -6,7 +6,7 @@ import re from datetime import datetime, timedelta -from openerp import api, fields, models, _ +from odoo import api, fields, models, _ from ..exceptions import PassError @@ -129,7 +129,7 @@ class ResUsers(models.Model): """ It validates proposed password against existing history :raises: PassError on reused password """ - crypt = self._crypt_context()[0] + crypt = self._crypt_context() for rec_id in self: recent_passes = rec_id.company_id.password_history if recent_passes < 0: diff --git a/password_security/models/res_users_pass_history.py b/password_security/models/res_users_pass_history.py index 8778341ac..156fdd568 100644 --- a/password_security/models/res_users_pass_history.py +++ b/password_security/models/res_users_pass_history.py @@ -2,7 +2,7 @@ # Copyright 2016 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). -from openerp import fields, models +from odoo import fields, models class ResUsersPassHistory(models.Model): diff --git a/password_security/tests/test_password_security_home.py b/password_security/tests/test_password_security_home.py index 3a9eafc71..b64b39e00 100644 --- a/password_security/tests/test_password_security_home.py +++ b/password_security/tests/test_password_security_home.py @@ -6,13 +6,13 @@ import mock from contextlib import contextmanager -from openerp.tests.common import TransactionCase -from openerp.http import Response +from odoo.tests.common import TransactionCase +from odoo.http import Response from ..controllers import main -IMPORT = 'openerp.addons.password_security.controllers.main' +IMPORT = 'odoo.addons.password_security.controllers.main' class EndTestException(Exception): diff --git a/password_security/tests/test_password_security_session.py b/password_security/tests/test_password_security_session.py index 2258b89eb..1e8f08379 100644 --- a/password_security/tests/test_password_security_session.py +++ b/password_security/tests/test_password_security_session.py @@ -6,12 +6,12 @@ import mock from contextlib import contextmanager -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase from ..controllers import main -IMPORT = 'openerp.addons.password_security.controllers.main' +IMPORT = 'odoo.addons.password_security.controllers.main' class EndTestException(Exception): diff --git a/password_security/tests/test_res_users.py b/password_security/tests/test_res_users.py index 6ce341ef5..dd0ccd0a3 100644 --- a/password_security/tests/test_res_users.py +++ b/password_security/tests/test_res_users.py @@ -4,7 +4,7 @@ import time -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase from ..exceptions import PassError