-
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
Feature to edit shell settings from the admin (OSOE-638) #66
Comments
Should this be a new project or is it okay to implement it in Lombiq.Hosting.Tenants.Management? |
|
Current state: Save settings button calls the following controller: [HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(ShellSettingsEditorViewModel model)
{
if (!await _authorizationService.AuthorizeAsync(User, ShellSettingsEditPermissions.ShellSettingsEditPermission))
{
return Forbid();
}
if (!_shellHost.TryGetSettings(model.TenantId, out var shellSettings))
{
return NotFound();
}
var jsonConfigurationParser = new JsonConfigurationParser();
var shellSettingsDictionary = jsonConfigurationParser.ParseConfiguration(model.Json);
foreach (var key in shellSettingsDictionary.Keys)
{
shellSettings[key] = shellSettingsDictionary[key];
}
await _shellHost.UpdateShellSettingsAsync(shellSettings);
return RedirectToAction(
nameof(AdminController.Edit),
typeof(AdminController).ControllerName(),
new
{
area = "OrchardCore.Tenants",
id = model.TenantId,
});
} The What I found is that I can only modify tenant configs such as: It looks like using UpdateShellSettingsAsync won't update other keys, just those: |
Displaying all currently editable settings by default is a good idea, but make sure that it's apparent that it's for scaffolding only. We don't want people to downright save what's displayed (since that would copy all existing config). Also, does this display settings coming from appsettings or everywhere? If the latter then rather don't display them because secret values can come from the environment. |
Yeah you are right, we shouldn't display everything, only the tenant level settings. There is a problem with saving shellSettings, it is not possible to save settings with more than one children because of this in var sections = settings.ShellConfiguration.GetChildren()
.Where(s => !s.GetChildren().Any())
.ToArray(); Meaning we can't save e.g. |
Please also reply to this:
I can't comment on the rest. |
Yes, from everywhere. |
I see, then that's not something that should happen due to it potentially exposing private data. |
@Piedone @wAsnk Just for infos and only from memory
Both take into account all config sources but we only allow a set of fields to be edited, on saving the final values are saved (if different), by default for Edited: I would say that you may need to override |
Since shell settings can serve as a source for configuration (see the discussion under #65) then it'll be really useful to be able to edit those shell settings from the admin area. So, add a textbox-based editor (perhaps Monaco, so whitespace can be easily managed) to the tenant editor that lets you change all shell settings (i.e. the whole
ShellSettings
dictionary).Jira issue
The text was updated successfully, but these errors were encountered: