-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSOE-638: Feature to edit shell settings from the admin in Lombiq.Hosting.Tenants #84
Conversation
Some info here #66 (comment) I looked at your controller before your last commit, it looks good, normally it should work. Are you sure that you provide kvps and with different values than those that may already be configured in another config source like the main appsettings.json? If for a given key the same value is already configured, it will not be persisted in the tenant specific config source. |
So basically for this: [Route("/shellSettingsTest")]
public async Task<IActionResult> Test()
{
if (!_shellHost.TryGetSettings("Default", out var shellSettings))
{
return NotFound();
}
shellSettings["SimpleKey"] = "SimpleValue";
shellSettings["Not:So:Simple:Key"] = "NotSoSimpleValue";
shellSettings["Default:Not:So:Simple:Key"] = "TenantSpecificNotSoSimpleValue";
await _shellHost.UpdateShellSettingsAsync(shellSettings);
if (!_shellHost.TryGetSettings("Default", out var shellSettingsNew))
{
return NotFound();
}
var result = $"{shellSettingsNew["SimpleKey"]}, {shellSettingsNew["Not:So:Simple:Key"]}, {shellSettingsNew["Default:Not:So:Simple:Key"]}";
return Json(result);
} |
Okay I understand, I thought it was not saving simple values too. Yes we use Maybe we are missing an extension point to be able to override this part, maybe worth to suggest a PR. And then yes, we only pass a
In the meantime a workaround would be to save the more complex values as json strings, but in that case we would not be able to check if the same underlying value exists in a previous source, hmm but maybe this checking could be done at the editor level. |
With my current solution I only save key-values if they are not already present in any configuration before, so it works this way. |
If you can access this screen then you're an admin in Orchard, but that doesn't mean that you should be able to see secrets coming from the infrastructure; that's a different access level. Hiding these on the client side, i.e. in a way that people can still get to them if they want to, is not a suitable solution. These shouldn't be sent to the client at all. |
We can limit showing it to users with a new custom permission. |
I really don't see a utility in that, since it adds more config requirements and opens up accidental disclosure. Please don't display anything, then, but a comment with instructions on how to use the feature, how to add config values. |
What settings do we don't want to show exactly? Because only settings under "OrchardCore" section are displayed and tenant configuration. If we don't display anything how do we know what's configured already for the tenant? Then you can only check blob storage or the file system for the tenant settings. But let me know if that's okay for you that we don't display anything we just display an input field with a prefilled example/hint. |
We should only display the configuration that users configured via the module, nothing else. |
If we don't save that to a new place other than the shellsettings I'm afraid we can't do that because we can't distinguish between settings saved from there or anywhere else. |
Then it seems we'll need to do that. Can't you otherwise mark a configuration key (like a comment)? |
I wouldn't complicate it with another provider or place to save it, because it depends where the key/value is saved depending on what feature is currently on, e.g. if blob storage is on it should be saved there e.g. So I will save a dummy key/value pair and the correct key/value pair as well, then I can filter by that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look into what JT has written.
Lombiq.Hosting.Tenants.Management.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Service/JsonConfigurationParser.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Service/JsonConfigurationParser.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Service/JsonConfigurationParser.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Service/JsonConfigurationParser.cs
Outdated
Show resolved
Hide resolved
…UITestContextExtensions.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
…torController.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
|
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Controllers/ShellSettingsEditorController.cs
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.Management/Service/JsonConfigurationParser.cs
Outdated
Show resolved
Hide resolved
…ser.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
…torController.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
OSOE-638
Fixes #66