From f2facdbac61c9a7133e8de7d7d7a37352a699a17 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Wed, 25 Sep 2024 12:09:05 -0400 Subject: [PATCH] Allow a non-admin user to create a settings file with a user context --- girder/girder_large_image/__init__.py | 2 +- girder/girder_large_image/rest/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/girder/girder_large_image/__init__.py b/girder/girder_large_image/__init__.py index 02e5e1acb..1c0f90b0f 100644 --- a/girder/girder_large_image/__init__.py +++ b/girder/girder_large_image/__init__.py @@ -613,7 +613,7 @@ def yamlConfigFileWrite(folder, name, user, yaml_config, user_context): :param user_context: whether these settings should only apply to the current user. """ yaml_parsed = yaml.safe_load(yaml_config) - item = Item().createItem(name, user, folder, reuseExisting=True) + item = Item().createItem(name, user, folder, reuseExisting=True, force=bool(user_context)) existingFiles = list(Item().childFiles(item)) if (len(existingFiles) == 1 and existingFiles[0]['mimeType'] == 'application/yaml' and diff --git a/girder/girder_large_image/rest/__init__.py b/girder/girder_large_image/rest/__init__.py index 225798dee..ecb33766f 100644 --- a/girder/girder_large_image/rest/__init__.py +++ b/girder/girder_large_image/rest/__init__.py @@ -141,7 +141,8 @@ def getYAMLConfigFile(self, folder, name): 'file may be permanently deleted.') .modelParam('id', model=Folder, level=AccessType.WRITE) .param('name', 'The name of the file.', paramType='path') - .param('user_context', 'Whether these settings should only apply to the current user.', paramType='query', dataType='boolean', default=False) + .param('user_context', 'Whether these settings should only apply to the ' + 'current user.', paramType='query', dataType='boolean', default=False) .param('config', 'The contents of yaml config file to validate.', paramType='body'), )