Print warning if packager try to show tile for regex and disable show tile in this case

This commit is contained in:
Josué Tille 2020-04-03 23:23:05 +02:00
parent 1ff4f578d7
commit e6ccb01af1
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
3 changed files with 7 additions and 2 deletions

View file

@ -501,6 +501,7 @@
"regenconf_dry_pending_applying": "Checking pending configuration which would have been applied for category '{category}'…",
"regenconf_failed": "Could not regenerate the configuration for category(s): {categories}",
"regenconf_pending_applying": "Applying pending configuration for category '{category}'…",
"regex_incompatible_with_tile": "/!\\ Packagers! You for the permission '{permission}' can't set the regex {regex} as main url and set 'show_tile' to 'true'",
"regex_with_only_domain": "You can't use a regex for domain, only for path",
"restore_already_installed_app": "An app with the ID '{app:s}' is already installed",
"restore_app_failed": "Could not restore the app '{app:s}'",

View file

@ -1325,7 +1325,7 @@ def app_ssowatconf():
permissions[perm_name] = {
"users": perm_info['corresponding_users'],
"label": perm_info['label'],
"show_tile": perm_info['show_tile'],
"show_tile": perm_info['show_tile'] if not perm_info["url"].startswith('re:') else False,
"auth_header": perm_info['auth_header'],
"public": "visitors" in perm_info["allowed"],
"uris": uris

View file

@ -167,6 +167,9 @@ def user_permission_update(operation_logger, permission, add=None, remove=None,
if "visitors" not in new_allowed_groups or len(new_allowed_groups) >= 3:
logger.warning(m18n.n("permission_currently_allowed_for_all_users"))
if existing_permission['url'].startswith('re:') and show_tile:
logger.warning(m18n.n('regex_incompatible_with_tile', regex=existing_permission['url'], permission=permission))
# Commit the new allowed group list
operation_logger.start()
@ -351,6 +354,8 @@ def permission_url(operation_logger, permission,
url = _check_and_normalize_permission_path(url)
domain, path = _get_full_url(url, app_main_path).split('/', 1)
conflicts = _get_conflicting_apps(domain, path, ignore_app=permission.spit('.')[0])
if url.startswith('re:') and existing_permission['show_tile']:
logger.warning(m18n.n('regex_incompatible_with_tile', regex=url, permission=permission))
if conflicts:
apps = []
@ -547,7 +552,6 @@ def _update_ldap_group_permission(permission, allowed,
if show_tile is None:
show_tile = existing_permission["show_tile"]
# TODO set show_tile to False if url is regex
if protected is None:
protected = existing_permission["protected"]