Browse Source

setting permissions bug fixed?

pull/6/head
Mathias Markl 6 years ago
parent
commit
fb7cbab3e5
  1. 2
      muk_utils/__manifest__.py
  2. 27
      muk_utils/models/res_users.py

2
muk_utils/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Utils",
"summary": """Utility Features""",
"version": '11.0.1.0.8',
"version": '11.0.1.0.9',
"category": 'Extra Tools',
"license": "AGPL-3",
"website": "https://www.mukit.at",

27
muk_utils/models/res_users.py

@ -54,21 +54,21 @@ class ResUser(models.Model):
@api.multi
def write(self, vals):
group_ids = self.mapped('groups_id.id')
result = super(ResUser, self).write(vals)
group_ids += [vals[k] for k in vals if res_users.is_selection_groups(k) and vals[k]]
group_ids += [vals[k] for k in vals if res_users.is_boolean_group(k) and vals[k]]
vals = self._remove_reified_groups(vals)
if any(field in vals for field in ['groups_id']):
group_ids += self.mapped('groups_id.id')
if group_ids:
model_recs = defaultdict(set)
model_names = self.pool.descendants(['muk_utils.groups'], '_inherit', '_inherits')
for model_name in model_names:
model = self.env[model_name].sudo()
if not model._abstract:
model_recs[model_name] = model.search([['groups', 'in', group_ids]])
for tuple in model_recs.items():
tuple[1].trigger_computation(['users'])
group_ids = [command[1] for command in vals['groups_id'] if command[0] == 4 or command[0] == 3]
group_ids += [id for command in vals['groups_id'] if command[0] == 6 for id in command[2]]
group_ids = list(set(group_ids))
if group_ids:
model_recs = defaultdict(set)
model_names = self.pool.descendants(['muk_utils.groups'], '_inherit', '_inherits')
for model_name in model_names:
model = self.env[model_name].sudo()
if not model._abstract:
model_recs[model_name] = model.search([['groups', 'in', group_ids]])
for tuple in model_recs.items():
tuple[1].trigger_computation(['users'])
return result
@api.multi
@ -82,4 +82,3 @@ class ResUser(models.Model):
result = super(ResUser, self).unlink()
for tuple in model_recs.items():
tuple[1].trigger_computation(['users'])
return result
Loading…
Cancel
Save