You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. import webnotes
  4. def before_install():
  5. webnotes.reload_doc("core", "doctype", "docfield")
  6. webnotes.reload_doc("core", "doctype", "docperm")
  7. webnotes.reload_doc("core", "doctype", "doctype")
  8. def after_install():
  9. # reset installed apps for re-install
  10. webnotes.conn.set_global("installed_apps", '["webnotes"]')
  11. # core users / roles
  12. install_docs = [
  13. {'doctype':'Profile', 'name':'Administrator', 'first_name':'Administrator',
  14. 'email':'admin@localhost', 'enabled':1},
  15. {'doctype':'Profile', 'name':'Guest', 'first_name':'Guest',
  16. 'email':'guest@localhost', 'enabled':1},
  17. {'doctype':'UserRole', 'parent': 'Administrator', 'role': 'Administrator',
  18. 'parenttype':'Profile', 'parentfield':'user_roles'},
  19. {'doctype':'UserRole', 'parent': 'Guest', 'role': 'Guest',
  20. 'parenttype':'Profile', 'parentfield':'user_roles'},
  21. {'doctype': "Role", "role_name": "Report Manager"}
  22. ]
  23. for d in install_docs:
  24. try:
  25. webnotes.bean(d).insert()
  26. except NameError:
  27. pass
  28. # all roles to admin
  29. webnotes.bean("Profile", "Administrator").get_controller().add_roles(*webnotes.conn.sql_list("""
  30. select name from tabRole"""))
  31. # update admin password
  32. from webnotes.auth import _update_password
  33. _update_password("Administrator", webnotes.conf.get("admin_password"))
  34. webnotes.conn.commit()