diff --git a/login_as_any_user/README.rst b/login_as_any_user/README.rst new file mode 100644 index 000000000..d36e553d6 --- /dev/null +++ b/login_as_any_user/README.rst @@ -0,0 +1,50 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Login As Any User +================= +The Login As Any User module in Odoo 17 enables administrators to log in as any +user in the system. With this module, you can test user access and permissions, +troubleshoot issues, or view the system as a specific user. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +* Developers: (V16) Mruthul Raj + (V17) Sabeel B +Contacts : odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/login_as_any_user/__init__.py b/login_as_any_user/__init__.py new file mode 100644 index 000000000..53a23e942 --- /dev/null +++ b/login_as_any_user/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import controllers +from . import models +from . import wizards +from . import session diff --git a/login_as_any_user/__manifest__.py b/login_as_any_user/__manifest__.py new file mode 100644 index 000000000..49a4747ff --- /dev/null +++ b/login_as_any_user/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +{ + 'name': 'Login As Any User', + 'version': '17.0.1.0.0', + 'category': 'Extra Tools', + 'summary': 'Admin can log in as any user', + 'description': 'The "Login As Any User" module allows administrators to ' + 'switch to any user account without the need for ' + 'passwords or other authentication.', + 'author': 'Cybrosys Techno Solution', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solution', + 'website': 'https://www.cybrosys.com', + 'depends': ['web'], + 'data': [ + 'security/ir.model.access.csv', + 'wizards/user_selection_views.xml' + ], + 'assets': { + 'web.assets_backend': [ + 'login_as_any_user/static/src/js/systray_button.js', + 'login_as_any_user/static/src/xml/systray_button_templates.xml', + ]}, + 'images': [ + 'static/description/banner.jpg' + ], + 'license': 'LGPL-3', + 'installable': True, + 'auto-install': False, + 'application': False, +} diff --git a/login_as_any_user/controllers/__init__.py b/login_as_any_user/controllers/__init__.py new file mode 100644 index 000000000..c44623589 --- /dev/null +++ b/login_as_any_user/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import login_as_any_user diff --git a/login_as_any_user/controllers/login_as_any_user.py b/login_as_any_user/controllers/login_as_any_user.py new file mode 100644 index 000000000..03f1d3b86 --- /dev/null +++ b/login_as_any_user/controllers/login_as_any_user.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import http +from odoo.http import request + + +class UserSwitch(http.Controller): + """This is a controller to switch user and switch back to admin + user_switch: + this function is to check weather the user is admin or not + switch_admin: + function to switch back to admin + """ + + @http.route('/switch/user', type='json', auth='public') + def user_switch(self): + """ + Summary: + function to check weather the user is admin + Return: + weather the current user is admin or not + """ + return request.env.user._is_admin() + + @http.route('/switch/admin', type='json', auth='public') + def switch_admin(self): + """ + Summary: + function to move back to admin + Return: + the home page to be loaded + """ + session = request.session + pre_user = request.env['res.users'].browse(session.previous_user) + if pre_user and pre_user._is_admin: + session.authenticate_without_password(request.env.cr.dbname, + pre_user.login, request.env) + return { + 'type': 'ir.actions.act_url', + 'url': '/', + 'target': 'self' + } + return True diff --git a/login_as_any_user/doc/RELEASE_NOTES.md b/login_as_any_user/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..e6fb62db0 --- /dev/null +++ b/login_as_any_user/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 15.01.2024 +#### Version 17.0.1.0.0 +#### ADD + +- Initial Commit for Login As Any User diff --git a/login_as_any_user/models/__init__.py b/login_as_any_user/models/__init__.py new file mode 100644 index 000000000..924b057d3 --- /dev/null +++ b/login_as_any_user/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import res_groups diff --git a/login_as_any_user/models/res_groups.py b/login_as_any_user/models/res_groups.py new file mode 100644 index 000000000..1724d53dc --- /dev/null +++ b/login_as_any_user/models/res_groups.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models + + +class ResGroups(models.Model): + """class to inherit a new field to res groups""" + _inherit = 'res.groups' + + user_id = fields.Many2one('user.selection', string="User", + help="Select User") diff --git a/login_as_any_user/security/ir.model.access.csv b/login_as_any_user/security/ir.model.access.csv new file mode 100644 index 000000000..16a9c477c --- /dev/null +++ b/login_as_any_user/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_user_selection_user,access.user.selection.user,model_user_selection,base.group_user,1,1,1,1 diff --git a/login_as_any_user/session.py b/login_as_any_user/session.py new file mode 100644 index 000000000..0641cfaac --- /dev/null +++ b/login_as_any_user/session.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +import odoo +from odoo.http import request, Session +from odoo.modules.registry import Registry + + +def authenticate_without_password(self, dbname, login, env): + """Function for login without password""" + registry = Registry(dbname) + pre_uid = env['res.users'].search([("login", '=', login)]).id + self.uid = None + self.pre_login = login + self.pre_uid = pre_uid + with registry.cursor() as cr: + env = odoo.api.Environment(cr, pre_uid, {}) + # If 2FA is disabled we finalize immediately + user = env['res.users'].browse(pre_uid) + if not user._mfa_url(): + self.finalize(env) + if request and request.session is self and request.db == dbname: + # Like update_env(user=request.session.uid) but works when uid is None + request.env = odoo.api.Environment(request.env.cr, self.uid, + self.context) + request.update_context(**self.context) + return pre_uid + + +Session.authenticate_without_password = authenticate_without_password diff --git a/login_as_any_user/static/description/assets/icons/capture (1).png b/login_as_any_user/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/capture (1).png differ diff --git a/login_as_any_user/static/description/assets/icons/check.png b/login_as_any_user/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/check.png differ diff --git a/login_as_any_user/static/description/assets/icons/chevron.png b/login_as_any_user/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/chevron.png differ diff --git a/login_as_any_user/static/description/assets/icons/cogs.png b/login_as_any_user/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/cogs.png differ diff --git a/login_as_any_user/static/description/assets/icons/consultation.png b/login_as_any_user/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/consultation.png differ diff --git a/login_as_any_user/static/description/assets/icons/ecom-black.png b/login_as_any_user/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/ecom-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/education-black.png b/login_as_any_user/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/education-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/hotel-black.png b/login_as_any_user/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/hotel-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/img.png b/login_as_any_user/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/img.png differ diff --git a/login_as_any_user/static/description/assets/icons/license.png b/login_as_any_user/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/license.png differ diff --git a/login_as_any_user/static/description/assets/icons/lifebuoy.png b/login_as_any_user/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/lifebuoy.png differ diff --git a/login_as_any_user/static/description/assets/icons/manufacturing-black.png b/login_as_any_user/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/manufacturing-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/photo-capture.png b/login_as_any_user/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/photo-capture.png differ diff --git a/login_as_any_user/static/description/assets/icons/pos-black.png b/login_as_any_user/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/pos-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/puzzle.png b/login_as_any_user/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/puzzle.png differ diff --git a/login_as_any_user/static/description/assets/icons/restaurant-black.png b/login_as_any_user/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/restaurant-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/service-black.png b/login_as_any_user/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/service-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/trading-black.png b/login_as_any_user/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/trading-black.png differ diff --git a/login_as_any_user/static/description/assets/icons/training.png b/login_as_any_user/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/training.png differ diff --git a/login_as_any_user/static/description/assets/icons/update.png b/login_as_any_user/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/update.png differ diff --git a/login_as_any_user/static/description/assets/icons/user.png b/login_as_any_user/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/user.png differ diff --git a/login_as_any_user/static/description/assets/icons/wrench.png b/login_as_any_user/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/login_as_any_user/static/description/assets/icons/wrench.png differ diff --git a/login_as_any_user/static/description/assets/misc/Cybrosys R.png b/login_as_any_user/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/Cybrosys R.png differ diff --git a/login_as_any_user/static/description/assets/misc/email.svg b/login_as_any_user/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/login_as_any_user/static/description/assets/misc/phone.svg b/login_as_any_user/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/login_as_any_user/static/description/assets/misc/star (1) 2.svg b/login_as_any_user/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/login_as_any_user/static/description/assets/misc/support (1) 1.svg b/login_as_any_user/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/login_as_any_user/static/description/assets/misc/support-email.svg b/login_as_any_user/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/login_as_any_user/static/description/assets/misc/tick-mark.svg b/login_as_any_user/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/login_as_any_user/static/description/assets/misc/whatsapp 1.svg b/login_as_any_user/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/login_as_any_user/static/description/assets/misc/whatsapp.svg b/login_as_any_user/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/login_as_any_user/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/login_as_any_user/static/description/assets/modules/1.png b/login_as_any_user/static/description/assets/modules/1.png new file mode 100644 index 000000000..0e311ca87 Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/1.png differ diff --git a/login_as_any_user/static/description/assets/modules/2.png b/login_as_any_user/static/description/assets/modules/2.png new file mode 100644 index 000000000..a0ac2d840 Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/2.png differ diff --git a/login_as_any_user/static/description/assets/modules/3.png b/login_as_any_user/static/description/assets/modules/3.png new file mode 100644 index 000000000..cb17cf612 Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/3.png differ diff --git a/login_as_any_user/static/description/assets/modules/4.jpg b/login_as_any_user/static/description/assets/modules/4.jpg new file mode 100644 index 000000000..67c7f7062 Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/4.jpg differ diff --git a/login_as_any_user/static/description/assets/modules/5.png b/login_as_any_user/static/description/assets/modules/5.png new file mode 100644 index 000000000..8513873ea Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/5.png differ diff --git a/login_as_any_user/static/description/assets/modules/6.jpg b/login_as_any_user/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..73781cf50 Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/6.jpg differ diff --git a/login_as_any_user/static/description/assets/screenshots/hero.gif b/login_as_any_user/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..25b7b8bba Binary files /dev/null and b/login_as_any_user/static/description/assets/screenshots/hero.gif differ diff --git a/login_as_any_user/static/description/assets/screenshots/scrnshot-1.png b/login_as_any_user/static/description/assets/screenshots/scrnshot-1.png new file mode 100644 index 000000000..6b429568b Binary files /dev/null and b/login_as_any_user/static/description/assets/screenshots/scrnshot-1.png differ diff --git a/login_as_any_user/static/description/assets/screenshots/scrnshot-2.png b/login_as_any_user/static/description/assets/screenshots/scrnshot-2.png new file mode 100644 index 000000000..4656e4b7c Binary files /dev/null and b/login_as_any_user/static/description/assets/screenshots/scrnshot-2.png differ diff --git a/login_as_any_user/static/description/assets/screenshots/scrnshot-3.png b/login_as_any_user/static/description/assets/screenshots/scrnshot-3.png new file mode 100644 index 000000000..7c0bbd034 Binary files /dev/null and b/login_as_any_user/static/description/assets/screenshots/scrnshot-3.png differ diff --git a/login_as_any_user/static/description/banner.jpg b/login_as_any_user/static/description/banner.jpg new file mode 100644 index 000000000..a18521001 Binary files /dev/null and b/login_as_any_user/static/description/banner.jpg differ diff --git a/login_as_any_user/static/description/icon.png b/login_as_any_user/static/description/icon.png new file mode 100644 index 000000000..a934d764a Binary files /dev/null and b/login_as_any_user/static/description/icon.png differ diff --git a/login_as_any_user/static/description/index.html b/login_as_any_user/static/description/index.html new file mode 100644 index 000000000..b81e19dba --- /dev/null +++ b/login_as_any_user/static/description/index.html @@ -0,0 +1,559 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Login As Any User

+

+ Now You Can Log In As + Any User In Odoo16. +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Test the Odoo System as Different Users.

+

Allows you to test the Odoo system from the perspective of different users +

+
+
+
+
+
+
+ +
+
+

Administrative Access

+

Admin can switch to another user without password and username +

+
+
+
+ +
+ +
+
+
+
+
+ +
+
+

+ User Selection Wizard.

+
+
+
+
+
+
+ +
+
+

+ Select user and click on switch user.

+
+
+
+
+
+
+ +
+
+

+ You will be logged into selected user.

+

*only admins can be logged to other user

+
+
+
+ + +
+
+
+
    +
  • + Allows you to test the Odoo system from the perspective of different users. +
  • +
  • + Helps to troubleshoot problems other users facing. +
  • +
  • + Switch to another user without password and username which can only be done by admins. +
  • + Available in Odoo 16 community and enterprise. +
  • + +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:12th December 2023 +
+

+ + Initial Commit for Login As Any User.

+
+
+
+
+
+
+
+

Related Products

+
+
+ +
+
+

Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Licensing Consultancy

+
+
+
+
+
+
+

Our Industries

+ +
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

Education

+

A platform for educational management

+
+
+
+
+ +

Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service Management

+

Keep track of services and invoice

+
+
+
+
+ +

Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to us on WhatsApp!

+
+91 + 99456767686
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/login_as_any_user/static/src/js/systray_button.js b/login_as_any_user/static/src/js/systray_button.js new file mode 100644 index 000000000..a85b0629d --- /dev/null +++ b/login_as_any_user/static/src/js/systray_button.js @@ -0,0 +1,36 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +import { useService } from "@web/core/utils/hooks"; +const { Component } = owl; +/** @extends {Component} for switching users */ +class UserSwitchWidget extends Component { + setup() { + super.setup(); + this.rpc = useService("rpc"); + this.action = useService("action"); + } + async _onClick(){ + var result = await this.rpc("/switch/user", {}); + if (result == true) { + this.action.doAction({ + type: 'ir.actions.act_window', + name: 'Switch User', + res_model: 'user.selection', + view_mode: 'form', + views: [ + [false, 'form'] + ], + target: 'new' + }) + }else{ + this.rpc("/switch/admin", {}).then(function(){ + location.reload(); + }) + } + } +} +UserSwitchWidget.template = "UserSwitchSystray"; +const Systray = { + Component: UserSwitchWidget +} +registry.category("systray").add("UserSwitchSystray", Systray) diff --git a/login_as_any_user/static/src/xml/systray_button_templates.xml b/login_as_any_user/static/src/xml/systray_button_templates.xml new file mode 100644 index 000000000..aeb248677 --- /dev/null +++ b/login_as_any_user/static/src/xml/systray_button_templates.xml @@ -0,0 +1,16 @@ + + + + +
+ +
+
+
diff --git a/login_as_any_user/wizards/__init__.py b/login_as_any_user/wizards/__init__.py new file mode 100644 index 000000000..9e978db2d --- /dev/null +++ b/login_as_any_user/wizards/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import user_selection diff --git a/login_as_any_user/wizards/user_selection.py b/login_as_any_user/wizards/user_selection.py new file mode 100644 index 000000000..225787b9f --- /dev/null +++ b/login_as_any_user/wizards/user_selection.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Sabeel B (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import api, fields, models +from odoo.http import request + + +class UserSelection(models.Model): + """ + class for a wizard for users selection + _onchange_user_id: + function to get corresponding user group + action_switch: + function for switching the user + """ + _name = 'user.selection' + _description = 'User Selection' + + user_id = fields.Many2one('res.users', string="User", + required=True, + help="Select the user here", + domain=lambda self: [ + ('id', '!=', self.env.user.id)]) + access_ids = fields.One2many('res.groups', + 'user_id', + help="User groups for the selection", + string="Group", readonly=True) + + @api.onchange('user_id') + def _onchange_user_id(self): + """ + Summary: + change function to get users access group + """ + self.access_ids = self.user_id.groups_id + + def action_switch(self): + """ + Summary: + function for switching the user + Return: + Main login page after logged in + """ + self.ensure_one() + session = request.session + session.update({ + 'previous_user': self.env.user.id, + }) + session.authenticate_without_password(self.env.cr.dbname, + self.user_id.login, self.env) + return { + 'type': 'ir.actions.act_url', + 'url': '/', + 'target': 'self' + } diff --git a/login_as_any_user/wizards/user_selection_views.xml b/login_as_any_user/wizards/user_selection_views.xml new file mode 100644 index 000000000..961574223 --- /dev/null +++ b/login_as_any_user/wizards/user_selection_views.xml @@ -0,0 +1,22 @@ + + + + + user.selection.view.form + user.selection + +
+ + + + + + +
+
+