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

[18.0][MIG] auth_user_case_insensitive: Migration to 18.0 #756

Open
wants to merge 22 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a59ac30
[IMP] auth_user_case_insensitive: Update module name
May 8, 2017
963d775
[IMP] auth_user_case_insensitive: Drop `search()` override in favor o…
May 9, 2017
23752e7
Note that existing logins are converted to lowercase
dreispt May 15, 2017
e46c4d5
[FIX/IMP] Fixed code for migration from v10 to v11 as per OCA standards.
mgosai Aug 17, 2018
a1d0102
[FIX] Fixed minor missing changes
mgosai Aug 17, 2018
7a75af4
Update __manifest__.py
Aug 20, 2018
8cfcb64
[MIG] auth_user_case_insensitive: Migration to 12.0
May 31, 2019
a047daf
[FIX] auth_user_case_insensitive: LDAP error in tests
remytms Oct 1, 2019
c3248a3
Translated using Weblate (Portuguese (Brazil))
Nov 24, 2019
b24da96
[MIG][13.0] Migrated the module in v13.
Chandresh-SerpentCS Nov 27, 2019
df12611
[MIG] Module migrated in v14.
Chandresh-SerpentCS Feb 10, 2021
1a35da5
[MIG] auth_user_case_insensitive: Migration to 15.0
Herqs Apr 11, 2022
193317e
[MIG] auth_user_case_insensitive: Migration to 16.0
Feb 17, 2023
5e3c361
Translated using Weblate (Spanish)
Ivorra78 Aug 25, 2023
af6e9df
Translated using Weblate (Italian)
mymage Jan 3, 2024
cd7e05b
[IMP] auth_user_case_insensitive: pre-commit stuff
Jan 29, 2024
fe26162
[MIG] auth_user_case_insensitive: Migration to 17.0
Jan 29, 2024
b019440
[UPD] Update auth_user_case_insensitive.pot
Apr 24, 2024
9addad3
[BOT] post-merge updates
OCA-git-bot Apr 24, 2024
2f8ed3f
Update translation files
weblate Apr 25, 2024
55e9917
[IMP] auth_user_case_insensitive: pre-commit auto fixes
El-khamisi Jan 23, 2025
2c59d4a
[MIG] auth_user_case_insensitive: Migration to 18.0
El-khamisi Jan 23, 2025
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
98 changes: 98 additions & 0 deletions auth_user_case_insensitive/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
=======================
Case Insensitive Logins
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:191e82e2a345b4dab163f77be2535319c23f64fb605fdba6bb24f8b4d0948c4e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/18.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-18-0/server-auth-18-0-auth_user_case_insensitive
:alt: Translate me on Weblate
.. |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=18.0
:alt: Try me on Runboat

|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
=====

|Steps to test the module|

.. |Steps to test the module| image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
: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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20auth_user_case_insensitive%0Aversion:%2018.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/18.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": "18.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",
}
34 changes: 34 additions & 0 deletions auth_user_case_insensitive/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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(env):
"""This hook will look to see if any conflicting logins exist before
the module is installed
:param env:
Environment.
"""
with env.cr.savepoint():
users = []
env.cr.execute("SELECT login FROM res_users")
for user in env.cr.fetchall():
login = user[0].lower()
if login not in users:
users.append(login)
else:
raise ValidationError(

Check warning on line 23 in auth_user_case_insensitive/hooks.py

View check run for this annotation

Codecov / codecov/patch

auth_user_case_insensitive/hooks.py#L23

Added line #L23 was not covered by tests
_("Conflicting user logins exist for `%s`", login)
)


def post_init_hook_login_convert(env):
"""After the module is installed, set all logins to lowercase
:param env:
Environment.
"""
with env.cr.savepoint():
env.cr.execute("UPDATE res_users SET login=lower(login)")
45 changes: 45 additions & 0 deletions auth_user_case_insensitive/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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
#. odoo-python
#: 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 "User"
msgstr ""

#~ msgid "Users"
#~ msgstr "المستخدمون"
36 changes: 36 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,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * auth_user_case_insensitive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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
#. odoo-python
#: 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 "User"
msgstr ""
44 changes: 44 additions & 0 deletions auth_user_case_insensitive/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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
#. odoo-python
#: 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 "User"
msgstr ""

#~ msgid "Users"
#~ msgstr "Usuaris"
44 changes: 44 additions & 0 deletions auth_user_case_insensitive/i18n/da.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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
#. odoo-python
#: 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 "User"
msgstr ""

#~ msgid "Users"
#~ msgstr "Brugere"
44 changes: 44 additions & 0 deletions auth_user_case_insensitive/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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
#. odoo-python
#: 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 "User"
msgstr ""

#~ msgid "Users"
#~ msgstr "Benutzer"
Loading
Loading