Fix some typos

This commit is contained in:
Josué Tille 2020-04-22 14:46:26 +02:00
parent e068133b54
commit 76c7bcc69b
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF

View file

@ -1155,16 +1155,14 @@ def app_setting(app, key, value=None, delete=False):
if urls == '/': if urls == '/':
if key.startswith("unprotected_") or key.startswith("skipped_"): if key.startswith("unprotected_") or key.startswith("skipped_"):
permission_url(app + ".main", url='/', sync_perm=False)
user_permission_update(app + ".main", add="visitors") user_permission_update(app + ".main", add="visitors")
else: else:
user_permission_update(app + ".main", remove="visitors") user_permission_update(app + ".main", remove="visitors")
else: else:
# Add re: in case of regex, as we distingish regex by this since the permission # Add re: in case of regex, as we distingish regex by this since the new permission system
if key.endswith('_regex'): if key.endswith('_regex'):
if urls.startswith('/'): urls = 're:' + urls
urls = 're:' + urls
else:
urls = 're:/' + urls
permissions = user_permission_list(full=True, full_path=False)['permissions'] permissions = user_permission_list(full=True, full_path=False)['permissions']
if permission_name in permissions: if permission_name in permissions:
@ -1179,15 +1177,15 @@ def app_setting(app, key, value=None, delete=False):
new_urls = urls.split(',') + actuals_urls_or_regex new_urls = urls.split(',') + actuals_urls_or_regex
# We need to clear urls because in the old setting the new setting override the old one and dont just add some urls # We need to clear urls because in the old setting the new setting override the old one and dont just add some urls
permission_url(clear_url=True, sync_perm=False) permission_url(permission_name, clear_urls=True, sync_perm=False)
permission_url(add_url=new_urls) permission_url(permission_name, add_url=new_urls)
else: else:
# Let's create a "special" permission for the legacy settings # Let's create a "special" permission for the legacy settings
permission_create(permission=permission, permission_create(permission=permission_name,
# FIXME find a way to limit to only the user allowed to the main permission # FIXME find a way to limit to only the user allowed to the main permission
allowed=['all_users'] if key.startswith('protected_') else ['all_users', 'visitors'], allowed=['all_users'] if key.startswith('protected_') else ['all_users', 'visitors'],
url=None, url=None,
additional_urls=url.split(','), additional_urls=urls.split(','),
auth_header=not key.startswith('skipped_'), auth_header=not key.startswith('skipped_'),
label="Legacy permission - %s_uris/regex for app : %s" % (key.split('_')[0], app), label="Legacy permission - %s_uris/regex for app : %s" % (key.split('_')[0], app),
show_tile=False, show_tile=False,