Skip to content

Commit ae49e77

Browse files
committed
Merge PR #714 into 18.0
Signed-off-by sebastienbeau
2 parents 8cba86b + 29d6da1 commit ae49e77

26 files changed

+1656
-0
lines changed

impersonate_login/README.rst

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
=================
2+
Impersonate Login
3+
=================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:1fca331cbc5f2dcb804e5612e5669a9ab4998d80f22d46d6683266580f9ca40f
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
20+
:target: https://github.com/OCA/server-auth/tree/18.0/impersonate_login
21+
:alt: OCA/server-auth
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/server-auth-18-0/server-auth-18-0-impersonate_login
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module allows one user (for example, a member of the support team)
32+
to log in as another user. The impersonation session can be exited by
33+
clicking on the button "Back to Original User".
34+
35+
To ensure that any abuse of this feature will not go unnoticed, the
36+
following measures are in place:
37+
38+
- In the chatter, it is displayed who is the user that is logged as
39+
another user.
40+
- Mails and messages are sent from the original user.
41+
- Impersonated logins are logged and can be consulted through the
42+
Settings -> Technical menu.
43+
-
44+
45+
There is an alternative module to allow logins as another user
46+
(auth_admin_passkey), but it does not support these security mechanisms.
47+
48+
**Table of contents**
49+
50+
.. contents::
51+
:local:
52+
53+
Configuration
54+
=============
55+
56+
The impersonating user must belong to group "Impersonate Users".
57+
58+
Usage
59+
=====
60+
61+
1. In the menu that is displayed when clicking on the user avatar on the
62+
top right corner, or in the res.users list, click "Switch Login" to
63+
impersonate another user.
64+
2. On the top-right corner, the button "Back to Original User" is
65+
displayed in case the current user is being impersonated.
66+
67+
Bug Tracker
68+
===========
69+
70+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/issues>`_.
71+
In case of trouble, please check there if your issue has already been reported.
72+
If you spotted it first, help us to smash it by providing a detailed and welcomed
73+
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20impersonate_login%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
74+
75+
Do not contact contributors directly about support or help with technical issues.
76+
77+
Credits
78+
=======
79+
80+
Authors
81+
-------
82+
83+
* Akretion
84+
85+
Contributors
86+
------------
87+
88+
- Kévin Roche <kevin.roche@akretion.com>
89+
- `360ERP <https://www.360erp.com>`__:
90+
91+
- Andrea Stirpe
92+
93+
Maintainers
94+
-----------
95+
96+
This module is maintained by the OCA.
97+
98+
.. image:: https://odoo-community.org/logo.png
99+
:alt: Odoo Community Association
100+
:target: https://odoo-community.org
101+
102+
OCA, or the Odoo Community Association, is a nonprofit organization whose
103+
mission is to support the collaborative development of Odoo features and
104+
promote its widespread use.
105+
106+
.. |maintainer-Kev-Roche| image:: https://github.com/Kev-Roche.png?size=40px
107+
:target: https://github.com/Kev-Roche
108+
:alt: Kev-Roche
109+
110+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
111+
112+
|maintainer-Kev-Roche|
113+
114+
This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/18.0/impersonate_login>`_ project on GitHub.
115+
116+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

impersonate_login/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import models
2+
from .hooks import pre_init_hook

impersonate_login/__manifest__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2024 Akretion (https://www.akretion.com).
2+
# @author Kévin Roche <kevin.roche@akretion.com>
3+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4+
5+
{
6+
"name": "Impersonate Login",
7+
"summary": "tools",
8+
"version": "18.0.1.0.0",
9+
"category": "Tools",
10+
"website": "https://github.com/OCA/server-auth",
11+
"author": "Akretion, Odoo Community Association (OCA)",
12+
"maintainers": ["Kev-Roche"],
13+
"license": "AGPL-3",
14+
"application": False,
15+
"installable": True,
16+
"depends": [
17+
"web",
18+
"mail",
19+
],
20+
"data": [
21+
"security/group.xml",
22+
"security/ir.model.access.csv",
23+
"views/res_users.xml",
24+
"views/impersonate_log.xml",
25+
],
26+
"assets": {
27+
"web.assets_backend": [
28+
"impersonate_login/static/src/js/user_menu.esm.js",
29+
],
30+
},
31+
"pre_init_hook": "pre_init_hook",
32+
}

impersonate_login/hooks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2024 360ERP (<https://www.360erp.com>)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
import logging
5+
6+
7+
def pre_init_hook(env):
8+
"""
9+
Pre-create the impersonated_author_id column in the mail_message table
10+
to prevent the ORM from invoking its compute method on a large volume
11+
of existing mail messages.
12+
"""
13+
logger = logging.getLogger(__name__)
14+
logger.info("Add mail_message.impersonated_author_id column if not exists")
15+
env.cr.execute(
16+
"ALTER TABLE mail_message "
17+
"ADD COLUMN IF NOT EXISTS "
18+
"impersonated_author_id INTEGER"
19+
)
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * impersonate_login
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: impersonate_login
17+
#. odoo-javascript
18+
#: code:addons/impersonate_login/static/src/js/user_menu.esm.js:0
19+
#, python-format
20+
msgid "Back to Original User"
21+
msgstr ""
22+
23+
#. module: impersonate_login
24+
#: model:ir.model,name:impersonate_login.model_base
25+
msgid "Base"
26+
msgstr ""
27+
28+
#. module: impersonate_login
29+
#: model:ir.model.fields,field_description:impersonate_login.field_mail_mail__body
30+
#: model:ir.model.fields,field_description:impersonate_login.field_mail_message__body
31+
msgid "Contents"
32+
msgstr ""
33+
34+
#. module: impersonate_login
35+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__create_uid
36+
msgid "Created by"
37+
msgstr ""
38+
39+
#. module: impersonate_login
40+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__create_date
41+
msgid "Created on"
42+
msgstr ""
43+
44+
#. module: impersonate_login
45+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__display_name
46+
msgid "Display Name"
47+
msgstr ""
48+
49+
#. module: impersonate_login
50+
#: model:ir.model,name:impersonate_login.model_mail_thread
51+
msgid "Email Thread"
52+
msgstr ""
53+
54+
#. module: impersonate_login
55+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__date_end
56+
msgid "End Date"
57+
msgstr ""
58+
59+
#. module: impersonate_login
60+
#: model:ir.model,name:impersonate_login.model_ir_http
61+
msgid "HTTP Routing"
62+
msgstr ""
63+
64+
#. module: impersonate_login
65+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__id
66+
msgid "ID"
67+
msgstr ""
68+
69+
#. module: impersonate_login
70+
#: model:ir.actions.act_window,name:impersonate_login.impersonate_log_action
71+
msgid "Impersonate Login Logs"
72+
msgstr ""
73+
74+
#. module: impersonate_login
75+
#: model:ir.model,name:impersonate_login.model_impersonate_log
76+
msgid "Impersonate Logs"
77+
msgstr ""
78+
79+
#. module: impersonate_login
80+
#: model:res.groups,name:impersonate_login.group_impersonate_login
81+
msgid "Impersonate Users"
82+
msgstr ""
83+
84+
#. module: impersonate_login
85+
#: model:ir.model.fields,field_description:impersonate_login.field_mail_mail__impersonated_author_id
86+
#: model:ir.model.fields,field_description:impersonate_login.field_mail_message__impersonated_author_id
87+
msgid "Impersonated Author"
88+
msgstr ""
89+
90+
#. module: impersonate_login
91+
#: model:ir.ui.menu,name:impersonate_login.menu_impersonate_log
92+
msgid "Impersonated Logs"
93+
msgstr ""
94+
95+
#. module: impersonate_login
96+
#. odoo-python
97+
#: code:addons/impersonate_login/models/res_users.py:0
98+
#, python-format
99+
msgid "It's you."
100+
msgstr ""
101+
102+
#. module: impersonate_login
103+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__write_uid
104+
msgid "Last Updated by"
105+
msgstr ""
106+
107+
#. module: impersonate_login
108+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__write_date
109+
msgid "Last Updated on"
110+
msgstr ""
111+
112+
#. module: impersonate_login
113+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__impersonated_partner_id
114+
msgid "Logged as"
115+
msgstr ""
116+
117+
#. module: impersonate_login
118+
#. odoo-python
119+
#: code:addons/impersonate_login/models/mail_message.py:0
120+
#: code:addons/impersonate_login/models/mail_message.py:0
121+
#, python-format
122+
msgid "Logged in as {}"
123+
msgstr ""
124+
125+
#. module: impersonate_login
126+
#: model:ir.model,name:impersonate_login.model_mail_message
127+
msgid "Message"
128+
msgstr ""
129+
130+
#. module: impersonate_login
131+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__date_start
132+
msgid "Start Date"
133+
msgstr ""
134+
135+
#. module: impersonate_login
136+
#. odoo-javascript
137+
#: code:addons/impersonate_login/static/src/js/user_menu.esm.js:0
138+
#: model_terms:ir.ui.view,arch_db:impersonate_login.impersonate_res_users_tree
139+
#, python-format
140+
msgid "Switch Login"
141+
msgstr ""
142+
143+
#. module: impersonate_login
144+
#: model:ir.model,name:impersonate_login.model_res_users
145+
#: model:ir.model.fields,field_description:impersonate_login.field_impersonate_log__user_id
146+
msgid "User"
147+
msgstr ""
148+
149+
#. module: impersonate_login
150+
#. odoo-python
151+
#: code:addons/impersonate_login/models/res_users.py:0
152+
#, python-format
153+
msgid "You are already Logged as another user."
154+
msgstr ""

0 commit comments

Comments
 (0)