Ver código fonte

add roles to the user (#4646)

version-14
Zarrar 7 anos atrás
committed by Rushabh Mehta
pai
commit
dda8ca42b0
1 arquivos alterados com 3 adições e 0 exclusões
  1. +3
    -0
      frappe/core/doctype/domain/domain.py

+ 3
- 0
frappe/core/doctype/domain/domain.py Ver arquivo

@@ -59,7 +59,9 @@ class Domain(Document):
def setup_roles(self):
'''Enable roles that are restricted to this domain'''
if self.data.restricted_roles:
user = frappe.get_doc("User", frappe.session.user)
for role_name in self.data.restricted_roles:
user.append("roles", {"role": role_name})
if not frappe.db.get_value('Role', role_name):
frappe.get_doc(dict(doctype='Role', role_name=role_name)).insert()
continue
@@ -67,6 +69,7 @@ class Domain(Document):
role = frappe.get_doc('Role', role_name)
role.disabled = 0
role.save()
user.save()

def setup_data(self, domain=None):
'''Load domain info via hooks'''


Carregando…
Cancelar
Salvar