Import default roles while making module and roles
This commit is contained in:
parent
d88b4a3b06
commit
2b5a0ee5f6
1 changed files with 4 additions and 2 deletions
|
|
@ -331,8 +331,10 @@ def make_module_and_roles(doclist, perm_doctype="DocPerm"):
|
|||
m = webnotes.bean({"doctype": "Module Def", "module_name": doclist[0].module})
|
||||
m.insert()
|
||||
|
||||
roles = list(set(p.role for p in doclist.get({"doctype": perm_doctype})))
|
||||
for role in roles:
|
||||
default_roles = ["Administrator", "Guest", "All"]
|
||||
roles = [p.role for p in doclist.get({"doctype": perm_doctype})] + default_roles
|
||||
|
||||
for role in list(set(roles)):
|
||||
if not webnotes.conn.exists("Role", role):
|
||||
r = webnotes.bean({"doctype": "Role", "role_name": role})
|
||||
r.doc.role_name = role
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue