-
-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] password_security: use ir.config_parameter
Replace fields on res.company by ir.config_parameter Remove dead test for v16 migration script
- Loading branch information
1 parent
ce6c04d
commit f9cf363
Showing
16 changed files
with
240 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Copyright 2015 LasLabs Inc. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). | ||
|
||
from .post_install import init_config_parameters | ||
from . import controllers, models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2024 Akretion France (http://www.akretion.com/) | ||
# @author: Alexis de Lattre <alexis.delattre@akretion.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
env.cr.execute( | ||
f"SELECT {openupgrade.get_legacy_name('password_expiration')}, " | ||
f"{openupgrade.get_legacy_name('password_minimum')}, " | ||
f"{openupgrade.get_legacy_name('password_history')}, " | ||
f"{openupgrade.get_legacy_name('password_lower')}, " | ||
f"{openupgrade.get_legacy_name('password_upper')}, " | ||
f"{openupgrade.get_legacy_name('password_numeric')}, " | ||
f"{openupgrade.get_legacy_name('password_special')} " | ||
"FROM res_company ORDER BY id LIMIT 1" | ||
) | ||
res = env.cr.fetchone() | ||
env["ir.config_parameter"].set_param("password_security.expiration_days", res[0]) | ||
env["ir.config_parameter"].set_param("password_security.minimum_hours", res[1]) | ||
env["ir.config_parameter"].set_param("password_security.history", res[2]) | ||
env["ir.config_parameter"].set_param("password_security.lower", res[3]) | ||
env["ir.config_parameter"].set_param("password_security.upper", res[4]) | ||
env["ir.config_parameter"].set_param("password_security.numeric", res[5]) | ||
env["ir.config_parameter"].set_param("password_security.special", res[6]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2024 Akretion France (http://www.akretion.com/) | ||
# @author: Alexis de Lattre <alexis.delattre@akretion.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.rename_fields( | ||
env, | ||
[ | ||
( | ||
"res.company", | ||
"res_company", | ||
"password_expiration", | ||
openupgrade.get_legacy_name("password_expiration"), | ||
), | ||
( | ||
"res.company", | ||
"res_company", | ||
"password_lower", | ||
openupgrade.get_legacy_name("password_lower"), | ||
), | ||
( | ||
"res.company", | ||
"res_company", | ||
"password_upper", | ||
openupgrade.get_legacy_name("password_upper"), | ||
), | ||
( | ||
"res.company", | ||
"res_company", | ||
"password_numeric", | ||
openupgrade.get_legacy_name("password_numeric"), | ||
), | ||
( | ||
"res.company", | ||
"res_company", | ||
"password_special", | ||
openupgrade.get_legacy_name("password_special"), | ||
), | ||
( | ||
"res.company", | ||
"res_company", | ||
"password_history", | ||
openupgrade.get_legacy_name("password_history"), | ||
), | ||
( | ||
"res.company", | ||
"res_company", | ||
"password_minimum", | ||
openupgrade.get_legacy_name("password_minimum"), | ||
), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
# Copyright 2015 LasLabs Inc. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). | ||
|
||
from . import res_company | ||
from . import res_config_settings | ||
from . import res_users | ||
from . import res_users_pass_history |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.