Browse Source

[FIX] As an ERP manager, allow to reset users' passwords

pull/1055/head
Stefan Rijnhart 7 years ago
parent
commit
7351c764d7
  1. 2
      password_security/__manifest__.py
  2. 7
      password_security/security/res_users_pass_history.xml
  3. 15
      password_security/tests/test_res_users.py

2
password_security/__manifest__.py

@ -5,7 +5,7 @@
'name': 'Password Security', 'name': 'Password Security',
"summary": "Allow admin to set password security requirements.", "summary": "Allow admin to set password security requirements.",
'version': '10.0.1.0.2',
'version': '10.0.1.1.0',
'author': "LasLabs, Odoo Community Association (OCA)", 'author': "LasLabs, Odoo Community Association (OCA)",
'category': 'Base', 'category': 'Base',
'depends': [ 'depends': [

7
password_security/security/res_users_pass_history.xml

@ -16,4 +16,11 @@
]</field> ]</field>
</record> </record>
<record id="res_users_pass_history_rule_manager" model="ir.rule">
<field name="name">Res Users Pass History Access/Managers</field>
<field name="model_id" ref="password_security.model_res_users_pass_history"/>
<field name="groups" eval="[(4, ref('base.group_erp_manager'))]"/>
<field name="domain_force">[(1, '=', 1)]</field>
</record>
</odoo> </odoo>

15
password_security/tests/test_res_users.py

@ -13,6 +13,20 @@ class TestResUsers(TransactionCase):
def setUp(self): def setUp(self):
super(TestResUsers, self).setUp() super(TestResUsers, self).setUp()
self.main_comp = self.env.ref('base.main_company')
# Modify users as privileged, but non-root user
privileged_user = self.env['res.users'].create({
'name': 'Privileged User',
'login': 'privileged_user@example.com',
'company_id': self.main_comp.id,
'groups_id': [
(4, self.env.ref('base.group_erp_manager').id),
(4, self.env.ref('base.group_partner_manager').id),
(4, self.env.ref('base.group_user').id),
],
})
privileged_user.email = privileged_user.login
self.env = self.env(user=privileged_user)
self.login = 'foslabs@example.com' self.login = 'foslabs@example.com'
self.partner_vals = { self.partner_vals = {
'name': 'Partner', 'name': 'Partner',
@ -20,7 +34,6 @@ class TestResUsers(TransactionCase):
'email': self.login, 'email': self.login,
} }
self.password = 'asdQWE123$%^' self.password = 'asdQWE123$%^'
self.main_comp = self.env.ref('base.main_company')
self.vals = { self.vals = {
'name': 'User', 'name': 'User',
'login': self.login, 'login': self.login,

Loading…
Cancel
Save