diff --git a/restrict_logins/__manifest__.py b/restrict_logins/__manifest__.py index f03ebeb17..245aaa71f 100644 --- a/restrict_logins/__manifest__.py +++ b/restrict_logins/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################### { 'name': 'Restrict Concurrent User Login', - 'version': '17.0.1.0.0', + 'version': '17.0.1.1.0', 'category': 'Extra Tools', 'summary': """Ensures restricted concurrent sessions, enforces user force logout, and automates session expiry for enhanced security.""", @@ -33,10 +33,12 @@ 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', 'website': 'https://www.cybrosys.com', + 'depends':['base_setup'], 'data': [ 'data/ir_cron_data.xml', 'views/res_users_views.xml', 'views/login_clear_session_template.xml', + 'views/res_config_settings_views.xml', ], 'images': ['static/description/banner.jpg'], 'license': 'LGPL-3', diff --git a/restrict_logins/doc/RELEASE_NOTES.md b/restrict_logins/doc/RELEASE_NOTES.md index 6be6ae45f..ae057409b 100644 --- a/restrict_logins/doc/RELEASE_NOTES.md +++ b/restrict_logins/doc/RELEASE_NOTES.md @@ -3,3 +3,9 @@ #### Version 17.0.1.0.0 ##### ADD - Initial Commit for Restrict Concurrent User Login + +#### 07.04.2025 +#### Version 17.0.1.1.0 +##### UPDT +- Added option inside settings to set session expiration time limit in minutes + diff --git a/restrict_logins/models/__init__.py b/restrict_logins/models/__init__.py index d26e73042..e872b610a 100644 --- a/restrict_logins/models/__init__.py +++ b/restrict_logins/models/__init__.py @@ -20,5 +20,6 @@ # ############################################################################### from . import ir_http +from . import res_config_settings from . import res_users diff --git a/restrict_logins/models/ir_http.py b/restrict_logins/models/ir_http.py index 277c622c3..5996aa879 100644 --- a/restrict_logins/models/ir_http.py +++ b/restrict_logins/models/ir_http.py @@ -61,7 +61,10 @@ class IrHttp(models.AbstractModel): sid = request.session.sid last_update = user_pool.last_update now = datetime.now() - exp_date = datetime.now() + timedelta(minutes=45) + session_time_limit = int( + request.env['ir.config_parameter'].sudo().get_param( + 'restrict_logins.session_expire_time')) + exp_date = datetime.now() + timedelta(minutes=session_time_limit) # Check that the authentication contains bus_inactivity # request_params = request.params.copy() # if 'options' in request_params and 'bus_inactivity' in \ diff --git a/restrict_logins/models/res_config_settings.py b/restrict_logins/models/res_config_settings.py new file mode 100644 index 000000000..c011a7797 --- /dev/null +++ b/restrict_logins/models/res_config_settings.py @@ -0,0 +1,8 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + session_expire_time = fields.Integer('Session Expire time In Minutes', + config_parameter='restrict_logins.session_expire_time') diff --git a/restrict_logins/models/res_users.py b/restrict_logins/models/res_users.py index e0a0a78c8..ee810bf59 100644 --- a/restrict_logins/models/res_users.py +++ b/restrict_logins/models/res_users.py @@ -98,7 +98,10 @@ class ResUsers(models.Model): def _save_session(self): """ Function for saving session details of the corresponding user.""" - exp_date = datetime.utcnow() + timedelta(minutes=45) + session_time_limit = int( + self.env['ir.config_parameter'].sudo().get_param( + 'restrict_logins.session_expire_time')) + exp_date = datetime.utcnow() + timedelta(minutes=session_time_limit) sid = request.session.sid self.with_user(SUPERUSER_ID).write({ 'sid': sid, diff --git a/restrict_logins/static/description/assets/screenshots/restrct_17_1.png b/restrict_logins/static/description/assets/screenshots/restrct_17_1.png new file mode 100644 index 000000000..c7de29832 Binary files /dev/null and b/restrict_logins/static/description/assets/screenshots/restrct_17_1.png differ diff --git a/restrict_logins/static/description/assets/screenshots/restrct_17_2.png b/restrict_logins/static/description/assets/screenshots/restrct_17_2.png new file mode 100644 index 000000000..9a3817548 Binary files /dev/null and b/restrict_logins/static/description/assets/screenshots/restrct_17_2.png differ diff --git a/restrict_logins/static/description/assets/screenshots/restrict_17_3.png b/restrict_logins/static/description/assets/screenshots/restrict_17_3.png new file mode 100644 index 000000000..daa0280f4 Binary files /dev/null and b/restrict_logins/static/description/assets/screenshots/restrict_17_3.png differ diff --git a/restrict_logins/static/description/index.html b/restrict_logins/static/description/index.html index 426bb185e..ebfba9b72 100644 --- a/restrict_logins/static/description/index.html +++ b/restrict_logins/static/description/index.html @@ -116,8 +116,7 @@
- Automatic Session Expiration After 45 - Minutes.
+ Option to set the session expiration time in settings.+ Added option inside settings to set session expiration time limit in minutes +
+