Define url of permission at the end of the app install

This commit is contained in:
Josué Tille 2020-04-04 00:36:01 +02:00
parent 6e5e118bcf
commit 8fabd8f140
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF

View file

@ -717,7 +717,7 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu
# Initialize the main permission for the app
# After the install, if apps don't have a domain and path defined, the default url '/' is removed from the permission
permission_create(app_instance_name+".main", url="/", allowed=["all_users"], label=label, show_tile=True, protected=False)
permission_create(app_instance_name+".main", allowed=["all_users"], label=label, show_tile=True, protected=False)
# Execute the app install script
install_failed = True
@ -830,12 +830,12 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu
os.system('chown -R root: %s' % app_setting_path)
os.system('chown -R admin: %s/scripts' % app_setting_path)
# If an app doesn't have at least a domain and a path, assume it's not a webapp and remove the default "/" permission
# If the app haven't set the url of the main permission and domain and path is set set / as main url
app_settings = _get_app_settings(app_instance_name)
domain = app_settings.get('domain', None)
path = app_settings.get('path', None)
if not (domain and path):
permission_url(app_instance_name + ".main", url=None, sync_perm=False)
if domain and path and user_permission_list(full=True, full_path=False)['permissions'][app_instance_name + '.main']['url'] is None:
permission_url(app_instance_name + ".main", url='/', sync_perm=False)
_migrate_legacy_permissions(app_instance_name)