Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] auth_user_case_insensitive: Migration to 15.0 #392

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions auth_user_case_insensitive/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
=======================
Case Insensitive Logins
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/15.0/auth_user_case_insensitive
: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_user_case_insensitive
: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
:alt: Try me on Runbot

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

This module makes user logins case insensitive. It also overwrites the
search method to allow these case insensitive logins to work on a database
that previously had case sensitive logins.

**Table of contents**

.. contents::
:local:

Installation
============

Install this module as you would any other. No further configuration is required.

Note that upon installation the existing logins will all be converted to lowercase.

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Steps to test the module
:target: https://runbot.odoo-community.org/runbot/167/11.0

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/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 <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_user_case_insensitive%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* LasLabs

Contributors
~~~~~~~~~~~~

* Dave Lasley <[email protected]>
* Ted Salmon <[email protected]>
* Mayank Gosai <[email protected]>
* Chandresh Thakkar <[email protected]>

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 <https://github.com/OCA/server-auth/tree/14.0/auth_user_case_insensitive>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
7 changes: 7 additions & 0 deletions auth_user_case_insensitive/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import models
from .hooks import pre_init_hook_login_check
from .hooks import post_init_hook_login_convert
18 changes: 18 additions & 0 deletions auth_user_case_insensitive/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2015-2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Case Insensitive Logins",
"summary": "Makes the user login field case insensitive",
"version": "15.0.1.0.0",
"category": "Authentication",
"website": "https://github.com/OCA/server-auth",
"author": "LasLabs, Odoo Community Association (OCA)",
"maintainer": "Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["mail"],
"pre_init_hook": "pre_init_hook_login_check",
"post_init_hook": "post_init_hook_login_convert",
}
36 changes: 36 additions & 0 deletions auth_user_case_insensitive/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2017 LasLabs Inc.
# Copyright 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import _
from odoo.exceptions import ValidationError


def pre_init_hook_login_check(cr):
"""This hook will look to see if any conflicting logins exist before
the module is installed
:param openerp.sql_db.Cursor cr:
Database cursor.
"""
with cr.savepoint():
users = []
cr.execute("SELECT login FROM res_users")
for user in cr.fetchall():
login = user[0].lower()
if login not in users:
users.append(login)
else:
raise ValidationError(
_("Conflicting user logins exist for `%s`") % login
)


def post_init_hook_login_convert(cr, registry):
"""After the module is installed, set all logins to lowercase
:param openerp.sql_db.Cursor cr:
Database cursor.
:param openerp.modules.registry.RegistryManager registry:
Database registry, using v7 api.
"""
with cr.savepoint():
cr.execute("UPDATE res_users SET login=lower(login)")
41 changes: 41 additions & 0 deletions auth_user_case_insensitive/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_user_case_insensitive
#
# Translators:
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-17 21:08+0000\n"
"PO-Revision-Date: 2017-05-17 21:08+0000\n"
"Last-Translator: OCA Transbot <[email protected]>, 2017\n"
"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#. module: auth_user_case_insensitive
#: code:addons/auth_user_case_insensitive/hooks.py:0
#, python-format
msgid "Conflicting user logins exist for `%s`"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users__login
msgid "Login"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,help:auth_user_case_insensitive.field_res_users__login
msgid "Used to log into the system. Case insensitive."
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model,name:auth_user_case_insensitive.model_res_users
msgid "Users"
msgstr "المستخدمون"
50 changes: 50 additions & 0 deletions auth_user_case_insensitive/i18n/auth_user_case_insensitive.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_user_case_insensitive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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: auth_user_case_insensitive
#: code:addons/auth_user_case_insensitive/hooks.py:0
#, python-format
msgid "Conflicting user logins exist for `%s`"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users__display_name
msgid "Display Name"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users__id
msgid "ID"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users____last_update
msgid "Last Modified on"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users__login
msgid "Login"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,help:auth_user_case_insensitive.field_res_users__login
msgid "Used to log into the system. Case insensitive."
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model,name:auth_user_case_insensitive.model_res_users
msgid "Users"
msgstr ""
40 changes: 40 additions & 0 deletions auth_user_case_insensitive/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_user_case_insensitive
#
# Translators:
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-01 02:43+0000\n"
"PO-Revision-Date: 2017-08-01 02:43+0000\n"
"Last-Translator: OCA Transbot <[email protected]>, 2017\n"
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: auth_user_case_insensitive
#: code:addons/auth_user_case_insensitive/hooks.py:0
#, python-format
msgid "Conflicting user logins exist for `%s`"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users__login
msgid "Login"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,help:auth_user_case_insensitive.field_res_users__login
msgid "Used to log into the system. Case insensitive."
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model,name:auth_user_case_insensitive.model_res_users
msgid "Users"
msgstr "Usuaris"
40 changes: 40 additions & 0 deletions auth_user_case_insensitive/i18n/da.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_user_case_insensitive
#
# Translators:
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-17 21:08+0000\n"
"PO-Revision-Date: 2017-05-17 21:08+0000\n"
"Last-Translator: OCA Transbot <[email protected]>, 2017\n"
"Language-Team: Danish (https://www.transifex.com/oca/teams/23907/da/)\n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: auth_user_case_insensitive
#: code:addons/auth_user_case_insensitive/hooks.py:0
#, python-format
msgid "Conflicting user logins exist for `%s`"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users__login
msgid "Login"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,help:auth_user_case_insensitive.field_res_users__login
msgid "Used to log into the system. Case insensitive."
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model,name:auth_user_case_insensitive.model_res_users
msgid "Users"
msgstr "Brugere"
40 changes: 40 additions & 0 deletions auth_user_case_insensitive/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_user_case_insensitive
#
# Translators:
# OCA Transbot <[email protected]>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-17 21:08+0000\n"
"PO-Revision-Date: 2017-05-17 21:08+0000\n"
"Last-Translator: OCA Transbot <[email protected]>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: auth_user_case_insensitive
#: code:addons/auth_user_case_insensitive/hooks.py:0
#, python-format
msgid "Conflicting user logins exist for `%s`"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,field_description:auth_user_case_insensitive.field_res_users__login
msgid "Login"
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model.fields,help:auth_user_case_insensitive.field_res_users__login
msgid "Used to log into the system. Case insensitive."
msgstr ""

#. module: auth_user_case_insensitive
#: model:ir.model,name:auth_user_case_insensitive.model_res_users
msgid "Users"
msgstr "Benutzer"
Loading