Browse Source

[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
pull/579/head
Dave Lasley 8 years ago
parent
commit
1f7598ba91
No known key found for this signature in database GPG Key ID: 7DDBA4BA81B934CF
  1. 10
      password_security/README.rst
  2. 4
      password_security/__manifest__.py
  3. 8
      password_security/controllers/main.py
  4. 2
      password_security/exceptions.py
  5. 2
      password_security/models/res_company.py
  6. 4
      password_security/models/res_users.py
  7. 2
      password_security/models/res_users_pass_history.py
  8. 6
      password_security/tests/test_password_security_home.py
  9. 4
      password_security/tests/test_password_security_session.py
  10. 2
      password_security/tests/test_res_users.py

10
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 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 Known Issues / Roadmap
====================== ======================

4
password_security/__manifest__.py

@ -5,7 +5,7 @@
'name': 'Password Security', 'name': 'Password Security',
"summary": "Allow admin to set password security requirements.", "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)", 'author': "LasLabs, Odoo Community Association (OCA)",
'category': 'Base', 'category': 'Base',
'depends': [ 'depends': [
@ -19,5 +19,5 @@
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'security/res_users_pass_history.xml', 'security/res_users_pass_history.xml',
], ],
'installable': False,
'installable': True,
} }

8
password_security/controllers/main.py

@ -4,10 +4,10 @@
import operator 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 from ..exceptions import PassError

2
password_security/exceptions.py

@ -2,7 +2,7 @@
# Copyright 2015 LasLabs Inc. # Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # 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): class PassError(UserError):

2
password_security/models/res_company.py

@ -2,7 +2,7 @@
# Copyright 2015 LasLabs Inc. # Copyright 2015 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # 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): class ResCompany(models.Model):

4
password_security/models/res_users.py

@ -6,7 +6,7 @@ import re
from datetime import datetime, timedelta from datetime import datetime, timedelta
from openerp import api, fields, models, _
from odoo import api, fields, models, _
from ..exceptions import PassError from ..exceptions import PassError
@ -129,7 +129,7 @@ class ResUsers(models.Model):
""" It validates proposed password against existing history """ It validates proposed password against existing history
:raises: PassError on reused password :raises: PassError on reused password
""" """
crypt = self._crypt_context()[0]
crypt = self._crypt_context()
for rec_id in self: for rec_id in self:
recent_passes = rec_id.company_id.password_history recent_passes = rec_id.company_id.password_history
if recent_passes < 0: if recent_passes < 0:

2
password_security/models/res_users_pass_history.py

@ -2,7 +2,7 @@
# Copyright 2016 LasLabs Inc. # Copyright 2016 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # 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): class ResUsersPassHistory(models.Model):

6
password_security/tests/test_password_security_home.py

@ -6,13 +6,13 @@ import mock
from contextlib import contextmanager 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 from ..controllers import main
IMPORT = 'openerp.addons.password_security.controllers.main'
IMPORT = 'odoo.addons.password_security.controllers.main'
class EndTestException(Exception): class EndTestException(Exception):

4
password_security/tests/test_password_security_session.py

@ -6,12 +6,12 @@ import mock
from contextlib import contextmanager from contextlib import contextmanager
from openerp.tests.common import TransactionCase
from odoo.tests.common import TransactionCase
from ..controllers import main from ..controllers import main
IMPORT = 'openerp.addons.password_security.controllers.main'
IMPORT = 'odoo.addons.password_security.controllers.main'
class EndTestException(Exception): class EndTestException(Exception):

2
password_security/tests/test_res_users.py

@ -4,7 +4,7 @@
import time import time
from openerp.tests.common import TransactionCase
from odoo.tests.common import TransactionCase
from ..exceptions import PassError from ..exceptions import PassError

Loading…
Cancel
Save