Skip to content

Commit 58ec085

Browse files
rvalyipedrobaeza
authored andcommitted
auth_admin_passkey to new API (#519)
1 parent 464ccb6 commit 58ec085

File tree

9 files changed

+185
-278
lines changed

9 files changed

+185
-278
lines changed

auth_admin_passkey/__init__.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
1-
# -*- encoding: utf-8 -*-
2-
##############################################################################
3-
#
4-
# Admin Passkey module for OpenERP
5-
# Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
6-
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
7-
#
8-
# This program is free software: you can redistribute it and/or modify
9-
# it under the terms of the GNU Affero General Public License as
10-
# published by the Free Software Foundation, either version 3 of the
11-
# License, or (at your option) any later version.
12-
#
13-
# This program is distributed in the hope that it will be useful,
14-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
# GNU Affero General Public License for more details.
17-
#
18-
# You should have received a copy of the GNU Affero General Public License
19-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20-
#
21-
##############################################################################
1+
# -*- coding: utf-8 -*-
2+
# Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
3+
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
4+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
225

23-
from . import model
6+
from . import models

auth_admin_passkey/__openerp__.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
# -*- encoding: utf-8 -*-
2-
##############################################################################
3-
#
4-
# Admin Passkey module for OpenERP
5-
# Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
6-
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
7-
#
8-
# This program is free software: you can redistribute it and/or modify
9-
# it under the terms of the GNU Affero General Public License as
10-
# published by the Free Software Foundation, either version 3 of the
11-
# License, or (at your option) any later version.
12-
#
13-
# This program is distributed in the hope that it will be useful,
14-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
# GNU Affero General Public License for more details.
17-
#
18-
# You should have received a copy of the GNU Affero General Public License
19-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20-
#
21-
##############################################################################
1+
# -*- coding: utf-8 -*-
2+
# Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
3+
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
4+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
225

236
{
247
'name': 'Authentification - Admin Passkey',
@@ -32,7 +15,7 @@
3215
],
3316
'data': [
3417
'data/ir_config_parameter.xml',
35-
'view/res_config_view.xml',
18+
'views/res_config_view.xml',
3619
],
3720
'demo': [],
3821
'js': [],

auth_admin_passkey/model/res_config.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

auth_admin_passkey/model/res_users.py

Lines changed: 0 additions & 137 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright (C) 2013-2014 GRAP (http://www.grap.coop)
3+
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
4+
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
5+
6+
from openerp import api, fields, models
7+
8+
9+
class BaseConfigSettings(models.TransientModel):
10+
_inherit = 'base.config.settings'
11+
12+
# Getter / Setter Section
13+
@api.model
14+
def get_default_auth_admin_passkey_send_to_admin(self, fields):
15+
return {
16+
'auth_admin_passkey_send_to_admin':
17+
self.env["ir.config_parameter"].get_param(
18+
"auth_admin_passkey.send_to_admin")
19+
}
20+
21+
@api.multi
22+
def set_auth_admin_passkey_send_to_admin(self):
23+
for config in self:
24+
self.env['ir.config_parameter'].set_param(
25+
"auth_admin_passkey.send_to_admin",
26+
config.auth_admin_passkey_send_to_admin or '')
27+
28+
@api.model
29+
def get_default_auth_admin_passkey_send_to_user(self, fields):
30+
return {
31+
'auth_admin_passkey_send_to_user':
32+
self.env["ir.config_parameter"].get_param(
33+
"auth_admin_passkey.send_to_user")
34+
}
35+
36+
@api.multi
37+
def set_auth_admin_passkey_send_to_user(self):
38+
for config in self:
39+
self.env['ir.config_parameter'].set_param(
40+
"auth_admin_passkey.send_to_user",
41+
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.""")

0 commit comments

Comments
 (0)