diff --git a/login_as_any_user/README.rst b/login_as_any_user/README.rst new file mode 100644 index 000000000..6162046fa --- /dev/null +++ b/login_as_any_user/README.rst @@ -0,0 +1,50 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg + :target: http://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 16 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 `__ + +Credits +------- +* Developers: (V16) Mruthul @cybrosys + +License +------- +General Public License, Version 3 (LGPL v3). +(http://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +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..9ee6137e5 --- /dev/null +++ b/login_as_any_user/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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, wizards +from . import models, session diff --git a/login_as_any_user/__manifest__.py b/login_as_any_user/__manifest__.py new file mode 100644 index 000000000..67ca7d951 --- /dev/null +++ b/login_as_any_user/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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': '16.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', + 'maintainer': 'Cybrosys Techno Solution', + 'company': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['base'], + '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.png' + ], + '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..b79642db6 --- /dev/null +++ b/login_as_any_user/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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_switch diff --git a/login_as_any_user/controllers/user_switch.py b/login_as_any_user/controllers/user_switch.py new file mode 100644 index 000000000..880a46483 --- /dev/null +++ b/login_as_any_user/controllers/user_switch.py @@ -0,0 +1,63 @@ +"""controller for switching user """ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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..49498cdfd --- /dev/null +++ b/login_as_any_user/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 09.08.2023 +#### Version 16.0.1.0.0 +#### ADD +- Initial Commit for Login As Any User \ No newline at end of file diff --git a/login_as_any_user/models/__init__.py b/login_as_any_user/models/__init__.py new file mode 100644 index 000000000..08bd8d96d --- /dev/null +++ b/login_as_any_user/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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..0ac2ef419 --- /dev/null +++ b/login_as_any_user/models/res_groups.py @@ -0,0 +1,31 @@ +"""class inherited in groups""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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..4807afe5b --- /dev/null +++ b/login_as_any_user/session.py @@ -0,0 +1,49 @@ +"""this python function is to log in as any user without password authentication""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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 Session, request +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/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/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/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/categories.png b/login_as_any_user/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/categories.png differ diff --git a/login_as_any_user/static/description/assets/misc/check-box.png b/login_as_any_user/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/check-box.png differ diff --git a/login_as_any_user/static/description/assets/misc/compass.png b/login_as_any_user/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/compass.png differ diff --git a/login_as_any_user/static/description/assets/misc/corporate.png b/login_as_any_user/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/corporate.png differ diff --git a/login_as_any_user/static/description/assets/misc/customer-support.png b/login_as_any_user/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/customer-support.png differ diff --git a/login_as_any_user/static/description/assets/misc/cybrosys-logo.png b/login_as_any_user/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/cybrosys-logo.png differ diff --git a/login_as_any_user/static/description/assets/misc/features.png b/login_as_any_user/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/features.png differ diff --git a/login_as_any_user/static/description/assets/misc/logo.png b/login_as_any_user/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/logo.png differ diff --git a/login_as_any_user/static/description/assets/misc/pictures.png b/login_as_any_user/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/pictures.png differ diff --git a/login_as_any_user/static/description/assets/misc/pie-chart.png b/login_as_any_user/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/pie-chart.png differ diff --git a/login_as_any_user/static/description/assets/misc/right-arrow.png b/login_as_any_user/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/right-arrow.png differ diff --git a/login_as_any_user/static/description/assets/misc/star.png b/login_as_any_user/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/star.png differ diff --git a/login_as_any_user/static/description/assets/misc/support.png b/login_as_any_user/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/support.png differ diff --git a/login_as_any_user/static/description/assets/misc/whatsapp.png b/login_as_any_user/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/login_as_any_user/static/description/assets/misc/whatsapp.png differ 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..ed175b076 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..a3194264c 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..e894393ef 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.png b/login_as_any_user/static/description/assets/modules/4.png new file mode 100644 index 000000000..f3c986fc1 Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/4.png 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..b21837312 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.png b/login_as_any_user/static/description/assets/modules/6.png new file mode 100644 index 000000000..e64a5b55c Binary files /dev/null and b/login_as_any_user/static/description/assets/modules/6.png 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..4d24ef207 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/ss1.png b/login_as_any_user/static/description/assets/screenshots/ss1.png new file mode 100644 index 000000000..a89ee264b Binary files /dev/null and b/login_as_any_user/static/description/assets/screenshots/ss1.png differ diff --git a/login_as_any_user/static/description/assets/screenshots/ss2.png b/login_as_any_user/static/description/assets/screenshots/ss2.png new file mode 100644 index 000000000..42fd15956 Binary files /dev/null and b/login_as_any_user/static/description/assets/screenshots/ss2.png differ diff --git a/login_as_any_user/static/description/assets/screenshots/ss3.png b/login_as_any_user/static/description/assets/screenshots/ss3.png new file mode 100644 index 000000000..e2cec3085 Binary files /dev/null and b/login_as_any_user/static/description/assets/screenshots/ss3.png differ diff --git a/login_as_any_user/static/description/banner.png b/login_as_any_user/static/description/banner.png new file mode 100644 index 000000000..15a597f41 Binary files /dev/null and b/login_as_any_user/static/description/banner.png 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..3254eb7cc 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..62cdaa5ed --- /dev/null +++ b/login_as_any_user/static/description/index.html @@ -0,0 +1,638 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

+ Login As Any User

+

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

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module helps log in as any user in your odoo +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + 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. +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ 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

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

+ Related + Products +

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

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ 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 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file 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..e5d818d46 --- /dev/null +++ b/login_as_any_user/static/src/js/systray_button.js @@ -0,0 +1,41 @@ +/** @odoo-module**/ +import SystrayMenu from 'web.SystrayMenu'; +import Widget from 'web.Widget'; +var rpc = require('web.rpc'); +var ajax = require('web.ajax'); +/** + * We define this module for the function of wizard button + * + */ +var UserSwitchWidget = Widget.extend({ + template: 'UserSwitchSystray', + events: { + 'click #switch_user': '_onClick', + }, + /** + * Click function for opening wizard and returning back to the user + */ + _onClick: function() { + var self=this + ajax.jsonRpc('/switch/user', 'call', {}).then(function(result) { + if (result == true) { + self.do_action({ + type: 'ir.actions.act_window', + name: 'Switch User', + res_model: 'user.selection', + view_mode: 'form', + views: [ + [false, 'form'] + ], + target: 'new' + }) + }else{ + ajax.jsonRpc('/switch/admin', 'call', {}).then(function(){ + location.reload(); + }) + } + }) + } +}) +SystrayMenu.Items.push(UserSwitchWidget) +export default UserSwitchWidget \ No newline at end of file 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..10ad3658b --- /dev/null +++ b/login_as_any_user/static/src/xml/systray_button_templates.xml @@ -0,0 +1,15 @@ + + + +
+ +
+
+
\ No newline at end of file diff --git a/login_as_any_user/wizards/__init__.py b/login_as_any_user/wizards/__init__.py new file mode 100644 index 000000000..2d2f79536 --- /dev/null +++ b/login_as_any_user/wizards/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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..86bdf70dc --- /dev/null +++ b/login_as_any_user/wizards/user_selection.py @@ -0,0 +1,71 @@ +"""selection wizard for switching user""" +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Mruthul Raj () +# +# 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", + 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..4aa8fd321 --- /dev/null +++ b/login_as_any_user/wizards/user_selection_views.xml @@ -0,0 +1,22 @@ + + + + + user.selection.view.form + user.selection + +
+ + + + + + +
+
+
\ No newline at end of file