Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

35 řádky
1.2 KiB

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