From 68558e24fbdb1dc590441d74e268aae270fdec67 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 22 Jun 2018 11:14:09 +0100 Subject: [PATCH 1/2] [FIX] password_security: Allow mini-admin to create users In a normal Odoo deployment, somebody in group *Administration / Access Rights* should be able to create users; but if this addon is installed, it gets this error: The requested operation cannot be completed due to security restrictions. Please contact your system administrator. (Document type: Res Users Password History, Operation: create) This is now tested and fixed. --- password_security/__manifest__.py | 2 +- .../security/res_users_pass_history.xml | 12 +++++++++++- password_security/tests/test_res_users.py | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/password_security/__manifest__.py b/password_security/__manifest__.py index cf95f41db9..054c6dedad 100644 --- a/password_security/__manifest__.py +++ b/password_security/__manifest__.py @@ -4,7 +4,7 @@ 'name': 'Password Security', "summary": "Allow admin to set password security requirements.", - 'version': '11.0.1.0.1', + 'version': '11.0.1.1.0', 'author': "LasLabs, " "Kaushal Prajapati, " diff --git a/password_security/security/res_users_pass_history.xml b/password_security/security/res_users_pass_history.xml index 2576a0d787..8e0cdd6e05 100644 --- a/password_security/security/res_users_pass_history.xml +++ b/password_security/security/res_users_pass_history.xml @@ -6,7 +6,7 @@ --> - + Res Users Pass History Access + + Res Users Pass History Access + + + [ + (1, '=', 1) + ] + + diff --git a/password_security/tests/test_res_users.py b/password_security/tests/test_res_users.py index 718b4a27a2..f21c784cf6 100644 --- a/password_security/tests/test_res_users.py +++ b/password_security/tests/test_res_users.py @@ -150,3 +150,11 @@ def test_underscore_is_special_character(self): self.assertTrue(self.main_comp.password_special) rec_id = self._new_record() rec_id._check_password('asdQWE12345_3') + + def test_user_with_admin_rights_can_create_users(self): + demo = self.env.ref("base.user_demo") + demo.groups_id |= self.env.ref("base.group_erp_manager") + self.model_obj.sudo(demo).create({ + "login": "test1", + "name": "test1", + }) From 82e07d15d405e0a7e8bc85e754d78c8085f952b0 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 22 Jun 2018 11:23:31 +0100 Subject: [PATCH 2/2] fixup! [FIX] password_security: Allow mini-admin to create users --- password_security/security/res_users_pass_history.xml | 6 +++++- password_security/tests/test_res_users.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/password_security/security/res_users_pass_history.xml b/password_security/security/res_users_pass_history.xml index 8e0cdd6e05..35f83ea5e8 100644 --- a/password_security/security/res_users_pass_history.xml +++ b/password_security/security/res_users_pass_history.xml @@ -17,8 +17,12 @@ ] - + Res Users Pass History Access + 0 + 0 + 1 + 0 diff --git a/password_security/tests/test_res_users.py b/password_security/tests/test_res_users.py index f21c784cf6..be9b42419a 100644 --- a/password_security/tests/test_res_users.py +++ b/password_security/tests/test_res_users.py @@ -154,7 +154,8 @@ def test_underscore_is_special_character(self): def test_user_with_admin_rights_can_create_users(self): demo = self.env.ref("base.user_demo") demo.groups_id |= self.env.ref("base.group_erp_manager") - self.model_obj.sudo(demo).create({ + test1 = self.model_obj.sudo(demo).create({ "login": "test1", "name": "test1", }) + test1.unlink()