15 changed files with 418 additions and 0 deletions
@ -0,0 +1,17 @@ |
|||
Access Restriction By IP V10 |
|||
============================ |
|||
|
|||
This module will restrict users access to his account from the specified IP only. If user access his |
|||
account from non-specified IP, login will be restricted and a warning message will be displayed in |
|||
login page. |
|||
|
|||
If no IP is specified for a user, then there will not be restriction by IP. He can access from any IP. |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
Cybrosys Techno Solutions |
|||
|
|||
Author |
|||
------ |
|||
* Niyas Raphy <niyas@cybrosys.in> |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import controllers |
|||
import models |
|||
|
@ -0,0 +1,41 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
{ |
|||
'name': 'Access Restriction By IP', |
|||
'summary': """User Can Access His Account Only From Specified IP Address""", |
|||
'version': '10.0.1.0.0', |
|||
'description': """User Can Access His Account Only From Specified IP Address""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'website': 'http://www.cybrosys.com', |
|||
'category': 'Tools', |
|||
'depends': ['base', 'mail'], |
|||
'license': 'AGPL-3', |
|||
'data': [ |
|||
'views/allowed_ips_view.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'demo': [], |
|||
'installable': True, |
|||
'auto_install': False, |
|||
} |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import main |
@ -0,0 +1,80 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo.addons.web.controllers import main |
|||
from odoo.http import request |
|||
from odoo.exceptions import Warning |
|||
import odoo |
|||
import odoo.modules.registry |
|||
from odoo.tools.translate import _ |
|||
from odoo import http |
|||
|
|||
|
|||
class Home(main.Home): |
|||
|
|||
@http.route('/web/login', type='http', auth="public") |
|||
def web_login(self, redirect=None, **kw): |
|||
main.ensure_db() |
|||
request.params['login_success'] = False |
|||
if request.httprequest.method == 'GET' and redirect and request.session.uid: |
|||
return http.redirect_with_hash(redirect) |
|||
|
|||
if not request.uid: |
|||
request.uid = odoo.SUPERUSER_ID |
|||
|
|||
values = request.params.copy() |
|||
try: |
|||
values['databases'] = http.db_list() |
|||
except odoo.exceptions.AccessDenied: |
|||
values['databases'] = None |
|||
if request.httprequest.method == 'POST': |
|||
old_uid = request.uid |
|||
ip_address = request.httprequest.environ['REMOTE_ADDR'] |
|||
if request.params['login']: |
|||
user_rec = request.env['res.users'].sudo().search([('login', '=', request.params['login'])]) |
|||
if user_rec.allowed_ips: |
|||
ip_list = [] |
|||
for rec in user_rec.allowed_ips: |
|||
ip_list.append(rec.ip_address) |
|||
if ip_address in ip_list: |
|||
uid = request.session.authenticate(request.session.db, request.params['login'], request.params['password']) |
|||
if uid is not False: |
|||
request.params['login_success'] = True |
|||
if not redirect: |
|||
redirect = '/web' |
|||
return http.redirect_with_hash(redirect) |
|||
request.uid = old_uid |
|||
values['error'] = _("Wrong login/password") |
|||
request.uid = old_uid |
|||
values['error'] = _("Not allowed to login from this IP") |
|||
else: |
|||
uid = request.session.authenticate(request.session.db, request.params['login'], |
|||
request.params['password']) |
|||
if uid is not False: |
|||
request.params['login_success'] = True |
|||
if not redirect: |
|||
redirect = '/web' |
|||
return http.redirect_with_hash(redirect) |
|||
request.uid = old_uid |
|||
values['error'] = _("Wrong login/password") |
|||
|
|||
return request.render('web.login', values) |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import allowed_ips |
|||
|
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# 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 |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class ResUsersInherit(models.Model): |
|||
_inherit = 'res.users' |
|||
|
|||
allowed_ips = fields.One2many('allowed.ips', 'users_ip', string='IP') |
|||
|
|||
|
|||
class AllowedIPs(models.Model): |
|||
_name = 'allowed.ips' |
|||
|
|||
users_ip = fields.Many2one('res.users', string='IP') |
|||
ip_address = fields.Char(string='Allowed IP') |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 32 KiB |
@ -0,0 +1,69 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">Access Restriction By IP</h2> |
|||
<h3 class="oe_slogan">User can access his account only from specified IP's</h3> |
|||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4> |
|||
<div> |
|||
<p>This module will restrict the users access to his account from specified IP address only</p> |
|||
</div> |
|||
<div> |
|||
<h4><p>Features:</p></h4> |
|||
<ul> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> Administrator can set a IP or a group of IP address for each users </li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> Users can access their account only from the specified IP's</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> Accessing system from a non-specified IP will restrict the user login</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> A warning message will be displayed</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> If no IP is set to user means there is no any restriction by IP</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> IP Address for each users can be set from users form view</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h4 class="oe_slogan">Setting IP address for User</h4> |
|||
<div class="oe_span12"> |
|||
<p>Setting IP address for user from users form view </p> |
|||
<p>User will be able to access his account only from this IP's</p> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img style="border:10px solid white;" class="oe_picture oe_screenshot" src="user_set_ip.png"> |
|||
</div> |
|||
</div> |
|||
<h4 class="oe_slogan">User accessing his account</h4> |
|||
<div class="oe_span12"> |
|||
<p>On accessing account from a non specified IP</p> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img style="border:10px solid white;" class="oe_picture oe_screenshot" src="access_non_set_ip.png"> |
|||
</div> |
|||
<p>Warning message will be displayed</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
|
|||
<section class="oe_container"> |
|||
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
|||
<div class="oe_slogan" style="margin-top:10px !important;"> |
|||
<div> |
|||
<a class="btn btn-primary btn-lg mt8" |
|||
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i |
|||
class="fa fa-envelope"></i> Email </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/contact/"><i |
|||
class="fa fa-phone"></i> Contact Us </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i |
|||
class="fa fa-check-square"></i> Request Customization </a> |
|||
</div> |
|||
<br> |
|||
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
|||
<div> |
|||
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
|||
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
|||
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
|||
</div> |
|||
</div> |
|||
</section> |
@ -0,0 +1,82 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_spaced"> |
|||
<h2 class="oe_slogan">Birthday Notification By E-mail</h2> |
|||
<h3 class="oe_slogan">This module will wish the employees on their birthday</h3> |
|||
|
|||
<h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4> |
|||
<div style="padding-left:66px;"> |
|||
<h4>Features:</h4> |
|||
<ul> |
|||
<li style="list-style:none !important;"><span style="color:green;"> →</span> Adds a cron job to invoke email</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> →</span> Adds an email template</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_spaced"> |
|||
<div class="oe_picture"> |
|||
<h3 class="oe_slogan">Overview</h3> |
|||
<p class="oe_mt32"> |
|||
HR departments need not worry to wish their employees for their Birthday. In this module we have included the feature to send an email Birthday notification to the employee. |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h4 class="oe_slogan">Employee Form</h4> |
|||
<div class="oe_span12"> |
|||
<p class='oe_mt32'> |
|||
☛ Give Date of Birth for employee.<br> |
|||
☛ Give work email.<br> |
|||
</p> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="birthday_1.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h4 class="oe_slogan">Email Template</h4> |
|||
<div class="oe_span12"> |
|||
<p class='oe_mt32'> |
|||
☛ The cron job will invoke the email<br> |
|||
☛ Email template is very simple<br> |
|||
</p> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="temp.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
|||
<div class="oe_slogan" style="margin-top:10px !important;"> |
|||
<div> |
|||
<a class="btn btn-primary btn-lg mt8" |
|||
style="color: #FFFFFF !important;border-radius: 0;" href="http://www.cybrosys.com"><i |
|||
class="fa fa-envelope"></i> Email </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="http://www.cybrosys.com/contact/"><i |
|||
class="fa fa-phone"></i> Contact Us </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i |
|||
class="fa fa-check-square"></i> Request Customization </a> |
|||
</div> |
|||
<br> |
|||
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
|||
<div> |
|||
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
|||
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
|||
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
|||
</div> |
|||
</div> |
|||
</section> |
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<odoo> |
|||
<data> |
|||
<record model="ir.ui.view" id="res_users_allowed_ips"> |
|||
<field name="name">res.users</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//page[1]" position='after'> |
|||
<page string="Allowed IP"> |
|||
<field name="allowed_ips"> |
|||
<tree editable="bottom"> |
|||
<field name="ip_address"/> |
|||
</tree> |
|||
</field> |
|||
</page> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
Loading…
Reference in new issue