Skip to content

Commit cc5a8b9

Browse files
author
Jonathan Nemry (ACSONE)
committed
[CHG] review of OCA#522 & add setup for auth_admin
1 parent 6d7134b commit cc5a8b9

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

auth_admin_passkey/__openerp__.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
55

66
{
7-
'name': 'Authentification - Admin Passkey',
7+
'name': 'Authentication - Admin Passkey',
88
'version': '8.0.2.1.1',
99
'category': 'base',
1010
'author': "GRAP,Odoo Community Association (OCA)",
@@ -17,12 +17,6 @@
1717
'data/ir_config_parameter.xml',
1818
'view/res_config_view.xml',
1919
],
20-
'demo': [],
21-
'js': [],
22-
'css': [],
23-
'qweb': [],
24-
'images': [],
25-
'post_load': '',
2620
'application': False,
2721
'installable': True,
2822
'auto_install': False,

auth_admin_passkey/model/res_config.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
class BaseConfigSettings(models.TransientModel):
1010
_inherit = 'base.config.settings'
1111

12+
auth_admin_passkey_send_to_admin = fields.Boolean(
13+
string='Send email to admin user.',
14+
help="""When the administrator use his password to login in """
15+
"""with a different account, OpenERP will send an email """
16+
"""to the admin user.""")
17+
18+
auth_admin_passkey_send_to_user = fields.Boolean(
19+
string='Send email to user.',
20+
help="""When the administrator use his password to login in """
21+
"""with a different account, OpenERP will send an email """
22+
"""to the account user.""")
23+
1224
# Getter / Setter Section
1325
@api.model
1426
def get_default_auth_admin_passkey_send_to_admin(self, fields):
@@ -39,15 +51,3 @@ def set_auth_admin_passkey_send_to_user(self):
3951
self.env['ir.config_parameter'].set_param(
4052
"auth_admin_passkey.send_to_user",
4153
config.auth_admin_passkey_send_to_user or '')
42-
43-
auth_admin_passkey_send_to_admin = fields.Boolean(
44-
string='Send email to admin user.',
45-
help="""When the administrator use his password to login in """
46-
"""with a different account, OpenERP will send an email """
47-
"""to the admin user.""")
48-
49-
auth_admin_passkey_send_to_user = fields.Boolean(
50-
string='Send email to user.',
51-
help="""When the administrator use his password to login in """
52-
"""with a different account, OpenERP will send an email """
53-
"""to the account user.""")

auth_admin_passkey/model/res_users.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
44
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
55

6-
import datetime
7-
86
from openerp import SUPERUSER_ID
97
from openerp import registry
108
from openerp import exceptions
11-
from openerp import models, api
9+
from openerp import api, fields, models
1210
from openerp.tools.translate import _
1311
from openerp.tools.safe_eval import safe_eval
1412

@@ -50,7 +48,7 @@ def _send_email_passkey(self, user_agent_env):
5048
"""\n\nTechnicals informations belows : \n\n"""
5149
"""- Login date : %s\n\n""")) % (
5250
login_user.login,
53-
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
51+
fields.Datetime.now())
5452
for k, v in user_agent_env.iteritems():
5553
body += ("- %s : %s\n\n") % (k, v)
5654
mail_obj.sudo().create({
@@ -68,7 +66,7 @@ def _send_email_same_password(self, login_user):
6866
mail_obj.sudo().create({
6967
'email_to': admin_user.email,
7068
'subject': self._get_translation(
71-
admin_user.lang, _('[WARNING] OpenERP Security Risk')),
69+
admin_user.lang, _('[WARNING] Odoo Security Risk')),
7270
'body_html': self._get_translation(
7371
admin_user.lang, _(
7472
"""<pre>User with login '%s' has the same """
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__import__('pkg_resources').declare_namespace(__name__)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../auth_admin_passkey

setup/auth_admin_passkey/setup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

0 commit comments

Comments
 (0)