Browse Source

Feb 17 [UPDT] : Updated 'restrict_logins'

pull/254/merge
AjmalCybro 2 months ago
parent
commit
41e962ba5e
  1. 4
      restrict_logins/__manifest__.py
  2. 2
      restrict_logins/controllers/restrict_logins.py
  3. 4
      restrict_logins/models/__init__.py
  4. 5
      restrict_logins/models/ir_http.py
  5. 9
      restrict_logins/models/res_config_settings.py
  6. 4
      restrict_logins/models/res_users.py
  7. BIN
      restrict_logins/static/description/assets/screenshots/restrict_session_1.png
  8. BIN
      restrict_logins/static/description/assets/screenshots/restrict_session_2.png
  9. BIN
      restrict_logins/static/description/assets/screenshots/restrict_session_time.png
  10. 25
      restrict_logins/static/description/index.html
  11. 29
      restrict_logins/views/res_config_settings_views.xml

4
restrict_logins/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': 'Restrict Concurrent User Login',
'version': '15.0.1.0.0',
'version': '15.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.png'],
'license': 'LGPL-3',

2
restrict_logins/controllers/restrict_logins.py

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.

4
restrict_logins/models/__init__.py

@ -19,5 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import res_users
from . import ir_http
from . import res_config_settings
from . import res_users

5
restrict_logins/models/ir_http.py

@ -60,7 +60,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 \

9
restrict_logins/models/res_config_settings.py

@ -0,0 +1,9 @@
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')

4
restrict_logins/models/res_users.py

@ -98,7 +98,9 @@ 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.httprequest.session.sid
self.with_user(SUPERUSER_ID).write({
'sid': sid,

BIN
restrict_logins/static/description/assets/screenshots/restrict_session_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
restrict_logins/static/description/assets/screenshots/restrict_session_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
restrict_logins/static/description/assets/screenshots/restrict_session_time.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

25
restrict_logins/static/description/index.html

@ -190,6 +190,31 @@
Enable the ability to force logout from devices that are already logged in.</p>
<img src="assets/screenshots/3.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Option to set the Session expiration time limit.</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Inside the Settings, we have an option to set the session expiration time limit in minutes.
</p>
<img src="assets/screenshots/restrict_session_time.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Current Session Expiration Time.</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
The session expiration time will be automatically set for users based on the time limit configured in the Settings.</p>
<img src="assets/screenshots/restrict_session_1.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Current Session Expiration Update.</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
The session expiration time will update automatically when the system is used continuously. However, if the system remains idle, it will automatically log out once the session expiration time is reached.</p>
<img src="assets/screenshots/restrict_session_2.png" class="img-thumbnail">
</div>
</div>
</div>
<!-- END OF SCREENSHOTS SECTION -->

29
restrict_logins/views/res_config_settings_views.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Settings view -->
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.restrict_logins
</field>
<field name="model">res.config.settings</field>
<field name="inherit_id"
ref="base_setup.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='feedback_motivate_setting']"
position="after">
<div class="col-12 col-lg-6 o_setting_box" groups="base.group_no_one" id="allow_import">
<div class="o_setting_left_pane">
<!-- <field name="session_expire_time"/>-->
</div>
<div class="o_setting_right_pane">
<label string="Session Expire Time" for="session_expire_time"/>
<div class="text-muted">
Allow users to set the Session Expiration time in Minutes
<field name="session_expire_time"/> Minutes
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save