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] base_user_empty_password #699

Open
wants to merge 6 commits into
base: 18.0
Choose a base branch
from
Open
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
94 changes: 94 additions & 0 deletions base_user_empty_password/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
====================
Empty users password
====================

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

.. |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/base_user_empty_password
: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-base_user_empty_password
: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 provides a wizard to allow emptying users password field.

This could be useful to force the user to use another sign on method
than Odoo.

**Table of contents**

.. contents::
:local:

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:%20base_user_empty_password%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
-------

* Camptocamp

Contributors
------------

- Akim Juillerat [email protected]
- Chau Le [email protected]

Other credits
-------------

The migration of this module from 14.0 to 18.0 was financially supported
by Camptocamp.

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.

.. |maintainer-grindtildeath| image:: https://github.com/grindtildeath.png?size=40px
:target: https://github.com/grindtildeath
:alt: grindtildeath

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-grindtildeath|

This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/18.0/base_user_empty_password>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions base_user_empty_password/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizard
21 changes: 21 additions & 0 deletions base_user_empty_password/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Empty users password",
"summary": "Allows to empty password of users",
"version": "18.0.1.0.0",
"development_status": "Beta",
"category": "Uncategorized",
"website": "https://github.com/OCA/server-auth",
"author": "Camptocamp, Odoo Community Association (OCA)",
"maintainers": ["grindtildeath"],
"license": "AGPL-3",
"depends": [
"base",
],
"data": [
"security/ir.model.access.csv",
"views/res_users.xml",
"wizard/empty_password.xml",
],
}
84 changes: 84 additions & 0 deletions base_user_empty_password/i18n/base_user_empty_password.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_user_empty_password
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.1alpha1+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-27 05:16+0000\n"
"PO-Revision-Date: 2024-09-27 05:16+0000\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: base_user_empty_password
#: model_terms:ir.ui.view,arch_db:base_user_empty_password.empty_password_wizard_view
msgid "Are you sure you want to empty password of selected users?"
msgstr ""

#. module: base_user_empty_password
#: model_terms:ir.ui.view,arch_db:base_user_empty_password.empty_password_wizard_view
msgid "Cancel"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__create_uid
msgid "Created by"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__create_date
msgid "Created on"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__display_name
msgid "Display Name"
msgstr ""

#. module: base_user_empty_password
#: model:ir.actions.act_window,name:base_user_empty_password.empty_password_wizard_action
#: model_terms:ir.ui.view,arch_db:base_user_empty_password.empty_password_wizard_view
msgid "Empty Password"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model,name:base_user_empty_password.model_empty_password_wizard
msgid "Empty Password Wizard"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_res_users__has_password
msgid "Has Password"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__id
msgid "ID"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__write_uid
msgid "Last Updated by"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__write_date
msgid "Last Updated on"
msgstr ""

#. module: base_user_empty_password
#. odoo-python
#: code:addons/base_user_empty_password/wizard/empty_password.py:0
msgid "This can only be used on users."
msgstr ""

#. module: base_user_empty_password
#: model:ir.model,name:base_user_empty_password.model_res_users
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__user_ids
msgid "User"
msgstr ""
1 change: 1 addition & 0 deletions base_user_empty_password/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_users
25 changes: 25 additions & 0 deletions base_user_empty_password/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import fields, models


class ResUsers(models.Model):
_inherit = "res.users"

has_password = fields.Boolean(compute="_compute_has_password")

def _compute_has_password(self):
# Bypass ORM as password is always empty in cache
self.env.cr.execute(
"""SELECT id, password FROM res_users WHERE id IN %s;""", (tuple(self.ids),)
)
res = {row[0]: row[1] for row in self.env.cr.fetchall()}
for user in self:
user.has_password = bool(res.get(user.id))

def _empty_password(self):
# Update in DB to avoid using crypt context
self.env.cr.execute(
"""UPDATE res_users SET password = %s WHERE id IN %s""",
("", (tuple(self.ids),)),
)
3 changes: 3 additions & 0 deletions base_user_empty_password/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions base_user_empty_password/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Akim Juillerat <[email protected]>
- Chau Le <[email protected]>
1 change: 1 addition & 0 deletions base_user_empty_password/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 14.0 to 18.0 was financially supported by Camptocamp.
3 changes: 3 additions & 0 deletions base_user_empty_password/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module provides a wizard to allow emptying users password field.

This could be useful to force the user to use another sign on method than Odoo.
2 changes: 2 additions & 0 deletions base_user_empty_password/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_empty_password_wizard,access_empty_password_wizard,model_empty_password_wizard,base.group_erp_manager,1,1,1,1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading