소스 검색

add roles to the user (#4646)

version-14
Zarrar 7 년 전
committed by Rushabh Mehta
부모
커밋
dda8ca42b0
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. +3
    -0
      frappe/core/doctype/domain/domain.py

+ 3
- 0
frappe/core/doctype/domain/domain.py 파일 보기

@@ -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'''


불러오는 중...
취소
저장