From 1801fcdc3dc1607e98bb92199686d1ca410824fd Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 20 Dec 2019 17:53:39 +0100 Subject: [PATCH] Bring Sahana config up-to-date --- .../install/sahana_conf/000_config.py | 16 +- .../sahana/install/sahana_conf/000_config.py | 14 +- .../sahana/install/sahana_conf/00_settings.py | 54 ++-- .../install/sahana_data/Spotter/config.py | 239 ++++++++++++--- .../sahana_data/Spotter/gis_hierarchy.csv | 3 + .../install/sahana_data/Spotter/monitor.py | 4 +- .../sahana_data/Spotter/organisation_type.csv | 2 +- .../install/sahana_data/Spotter/parser.py | 2 +- .../sahana_data/Spotter/views/layout.html | 6 +- .../sambro/install/sahana_conf/000_config.py | 24 +- .../sambro/install/sahana_conf/00_settings.py | 54 ++-- .../install/sahana_data/SAMBRO/config.py | 275 ++++++++++++------ 12 files changed, 483 insertions(+), 210 deletions(-) diff --git a/lxc-apps/sahana-demo/install/sahana_conf/000_config.py b/lxc-apps/sahana-demo/install/sahana_conf/000_config.py index ac2a261..0344a50 100644 --- a/lxc-apps/sahana-demo/install/sahana_conf/000_config.py +++ b/lxc-apps/sahana-demo/install/sahana_conf/000_config.py @@ -68,8 +68,8 @@ settings.base.debug = True # Uncomment this to prevent automated test runs from remote # settings.base.allow_testing = False -# Configure the log level ("DEBUG", "INFO", "WARNING", "ERROR" or "CRITICAL"), None = turn off logging -#settings.log.level = "WARNING" +# Configure the log level ("DEBUG", "INFO", "WARNING", "ERROR" or "CRITICAL"), None = turn off logging (default) +#settings.log.level = "ERROR" # DEBUG set automatically when base.debug is True # Uncomment to prevent writing log messages to the console (sys.stderr) #settings.log.console = False # Configure a log file (file name) @@ -87,6 +87,9 @@ settings.base.debug = True # - should happen automatically if installing using supported scripts settings.auth.hmac_key = "${SAHANADEMO_HMAC}" +# If using Masterkey Authentication, then set this to a deployment-specific 32 char string: +#settings.auth.masterkey_app_key = "randomstringrandomstringrandomstring" + # Minimum Password Length #settings.auth.password_min_length = 8 @@ -103,7 +106,7 @@ settings.mail.server = "host:25" settings.mail.sender = "admin@example.com" # Default email address to which requests to approve new user accounts gets sent # This can be overridden for specific domains/organisations via the auth_domain table -#settings.mail.approver = "useradmin@example.org" +settings.mail.approver = "admin@example.com" # Daily Limit on Sending of emails #settings.mail.limit = 1000 @@ -215,10 +218,8 @@ settings.base.session_db = True # See http://alerting.worldweather.org/ for oid # Country root oid. The oid for the organisation includes this base #settings.cap.identifier_oid = "2.49.0.0.608.0" -# Change this for the offset period in days that the alert will be effective for -# Expire Date = Effective Date + expire_offset -# Default is 2 days -#settings.cap.expire_offset = 2 +# Set the period (in days) after which alert info segments expire (default=2) +#settings.cap.info_effective_period = 2 # ============================================================================= # Import the settings from the Template @@ -238,6 +239,7 @@ settings.import_template() #settings.L10n.default_language = "en" #settings.security.policy = 7 # Organisation-ACLs # Enable Additional Module(s) +#from gluon.storage import Storage #settings.modules["delphi"] = Storage( # name_nice = T("Delphi Decision Maker"), # restricted = False, diff --git a/lxc-apps/sahana/install/sahana_conf/000_config.py b/lxc-apps/sahana/install/sahana_conf/000_config.py index 01dfa30..943356d 100644 --- a/lxc-apps/sahana/install/sahana_conf/000_config.py +++ b/lxc-apps/sahana/install/sahana_conf/000_config.py @@ -68,8 +68,8 @@ settings.base.debug = True # Uncomment this to prevent automated test runs from remote # settings.base.allow_testing = False -# Configure the log level ("DEBUG", "INFO", "WARNING", "ERROR" or "CRITICAL"), None = turn off logging -#settings.log.level = "WARNING" +# Configure the log level ("DEBUG", "INFO", "WARNING", "ERROR" or "CRITICAL"), None = turn off logging (default) +#settings.log.level = "ERROR" # DEBUG set automatically when base.debug is True # Uncomment to prevent writing log messages to the console (sys.stderr) #settings.log.console = False # Configure a log file (file name) @@ -87,6 +87,9 @@ settings.base.debug = True # - should happen automatically if installing using supported scripts settings.auth.hmac_key = "${SAHANA_HMAC}" +# If using Masterkey Authentication, then set this to a deployment-specific 32 char string: +#settings.auth.masterkey_app_key = "randomstringrandomstringrandomstring" + # Minimum Password Length #settings.auth.password_min_length = 8 @@ -219,10 +222,8 @@ settings.base.session_db = True # See http://alerting.worldweather.org/ for oid # Country root oid. The oid for the organisation includes this base #settings.cap.identifier_oid = "2.49.0.0.608.0" -# Change this for the offset period in days that the alert will be effective for -# Expire Date = Effective Date + expire_offset -# Default is 2 days -#settings.cap.expire_offset = 2 +# Set the period (in days) after which alert info segments expire (default=2) +#settings.cap.info_effective_period = 2 # ============================================================================= # Import the settings from the Template @@ -242,6 +243,7 @@ settings.import_template() #settings.L10n.default_language = "en" #settings.security.policy = 7 # Organisation-ACLs # Enable Additional Module(s) +#from gluon.storage import Storage #settings.modules["delphi"] = Storage( # name_nice = T("Delphi Decision Maker"), # restricted = False, diff --git a/lxc-apps/sahana/install/sahana_conf/00_settings.py b/lxc-apps/sahana/install/sahana_conf/00_settings.py index 009e3a7..5610291 100644 --- a/lxc-apps/sahana/install/sahana_conf/00_settings.py +++ b/lxc-apps/sahana/install/sahana_conf/00_settings.py @@ -88,6 +88,7 @@ s3.stylesheets = [] s3.external_stylesheets = [] # To get included at the end of s3.scripts = [] +s3.scripts_modules = [] s3.js_global = [] s3.jquery_ready = [] @@ -194,20 +195,23 @@ _settings.allow_basic_login = True _settings.logout_onlogout = s3_auth_on_logout _settings.login_onaccept = s3_auth_on_login -_settings.login_next = settings.get_auth_login_next() +# Now read in auth.login() to avoid setting unneccesarily in every request +#_settings.login_next = settings.get_auth_login_next() if settings.has_module("vol") and \ settings.get_auth_registration_volunteer(): _settings.register_next = URL(c="vol", f="person") # Languages available in User Profiles -if len(s3.l10n_languages) > 1: - _settings.table_user.language.requires = IS_IN_SET(s3.l10n_languages, - zero=None) -else: - field = _settings.table_user.language - field.default = s3.l10n_languages.keys()[0] - field.readable = False - field.writable = False +#if len(s3.l10n_languages) > 1: +# _settings.table_user.language.requires = s3base.IS_ISO639_2_LANGUAGE_CODE(sort = True, +# translate = True, +# zero = None, +# ) +#else: +# field = _settings.table_user.language +# field.default = s3.l10n_languages.keys()[0] +# field.readable = False +# field.writable = False _settings.lock_keys = True @@ -241,14 +245,14 @@ session.information = [] session.warning = [] # Shortcuts for system role IDs, see modules/s3aaa.py/AuthS3 -system_roles = auth.get_system_roles() -ADMIN = system_roles.ADMIN -AUTHENTICATED = system_roles.AUTHENTICATED -ANONYMOUS = system_roles.ANONYMOUS -EDITOR = system_roles.EDITOR -MAP_ADMIN = system_roles.MAP_ADMIN -ORG_ADMIN = system_roles.ORG_ADMIN -ORG_GROUP_ADMIN = system_roles.ORG_GROUP_ADMIN +#system_roles = auth.get_system_roles() +#ADMIN = system_roles.ADMIN +#AUTHENTICATED = system_roles.AUTHENTICATED +#ANONYMOUS = system_roles.ANONYMOUS +#EDITOR = system_roles.EDITOR +#MAP_ADMIN = system_roles.MAP_ADMIN +#ORG_ADMIN = system_roles.ORG_ADMIN +#ORG_GROUP_ADMIN = system_roles.ORG_GROUP_ADMIN if s3.debug: # Add the developer toolbar from modules/s3/s3utils.py @@ -261,15 +265,15 @@ s3_formstyle = settings.get_ui_formstyle() s3_formstyle_read = settings.get_ui_formstyle_read() s3_formstyle_mobile = s3_formstyle submit_button = T("Save") -_crud = s3.crud -_crud.formstyle = s3_formstyle -_crud.formstyle_read = s3_formstyle_read -_crud.submit_button = submit_button +s3_crud = s3.crud +s3_crud.formstyle = s3_formstyle +s3_crud.formstyle_read = s3_formstyle_read +s3_crud.submit_button = submit_button # Optional class for Submit buttons -#_crud.submit_style = "submit-button" -_crud.confirm_delete = T("Do you really want to delete these records?") -_crud.archive_not_delete = settings.get_security_archive_not_delete() -_crud.navigate_away_confirm = settings.get_ui_navigate_away_confirm() +#s3_crud.submit_style = "submit-button" +s3_crud.confirm_delete = T("Do you really want to delete these records?") +s3_crud.archive_not_delete = settings.get_security_archive_not_delete() +s3_crud.navigate_away_confirm = settings.get_ui_navigate_away_confirm() # Content Type Headers, default is application/xml for XML formats # and text/x-json for JSON formats, other content types must be diff --git a/lxc-apps/sahana/install/sahana_data/Spotter/config.py b/lxc-apps/sahana/install/sahana_data/Spotter/config.py index d952e3c..3bf808f 100644 --- a/lxc-apps/sahana/install/sahana_data/Spotter/config.py +++ b/lxc-apps/sahana/install/sahana_data/Spotter/config.py @@ -20,6 +20,9 @@ def config(settings): # In Production, prepopulate = 0 (to save 1x DAL hit every page) settings.base.prepopulate.append("Spotter") + # Uncomment this to prefer scalability-optimized strategies globally + #settings.base.bigtable = True + # Theme (folder to use for views/layout.html) #settings.base.theme = "default" @@ -35,6 +38,8 @@ def config(settings): #settings.auth.registration_requires_verification = True # Do new users need to be approved by an administrator prior to being able to login? #settings.auth.registration_requires_approval = True + # Disable welcome-emails to newly registered users + #settings.auth.registration_welcome_email = False # Allow a new user to be linked to a record (and a new record will be created if it doesn't already exist) settings.auth.registration_link_user_to = {"staff":T("Staff"), @@ -72,8 +77,6 @@ def config(settings): #settings.auth.registration_requests_site = True # Uncomment this to allow Admin to see Organisations in User Admin even if the Registration doesn't request this #settings.auth.admin_sees_organisation = True - # Uncomment to hide the UTC Offset in Registration/Profile - #settings.auth.show_utc_offset = False # Uncomment to set the default role UUIDs assigned to newly-registered users # This is a dictionary of lists, where the key is the realm that the list of roles applies to # The key 0 implies not realm restricted @@ -104,14 +107,20 @@ def config(settings): # https://termsfeed.com/terms-conditions/generator/ # uses