Skip to content
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

#1880 Issue with new SettingService #1882

Merged
merged 1 commit into from
Dec 16, 2021
Merged

#1880 Issue with new SettingService #1882

merged 1 commit into from
Dec 16, 2021

Conversation

leigh-pointer
Copy link
Contributor

Needed to update the SettingService to apply the IsPublic field when updating settings for the ModuleDefinition.

Needed to update the SettingService to apply the IsPublic field when updating settings for the ModuleDefinition.
@sbwalker
Copy link
Member

sbwalker commented Dec 16, 2021

Thank you @leigh-pointer ... to provide a bit more background, the SettingService relies on a standard Dictionary type (ie. name/value pairs) to make the API as simple as possible for developers. However this makes it difficult to support additional metadata for settings without breaking the API. So the IsPublic property is "supported" by embedding the metadata into the Dictionary value and then parsing/interpreting the value during load/save. This makes the internal code of the SettingService less intuitive and more complex - but it does shield the consumer of the API from these internal complexities.

The bug you ran into is caused by logic which is trying to be very specific about the specific types of settings which support the IsPublic property. Originally it was introduced for Site Settings - and the use case was that the SMTP details for a site are stored in Site Settings - however that information is sensitive and should not be disclosed to non-Administrators - so there needed to be a mechanism to be able to filter Site Settings for standard users. The IsPublic concept accomplishes this... however there is currently a drawback to the implementation:

The IsPublic concept is currently only enabled for some setting types and not others. This can cause issues if a developer tries to use the SetSetting(...IsPublic) overload method for types other than Site - which is the scenario you ran into for ModuleDefinition. The problem is that the supported types are static - but the SettingService is intended to be dynamic.

One possible solution is to make the IsPublic concept applicable to ALL setting types. This would eliminate the hard-coded logic for checking if a specific type supports it or not. I do not really see a downside to this approach as the concept could be valuable for all types. Basically the service would ensure the user is authorized to access the settings for the specific setting type and entityid - and if so, it would then filter the results.

What are your thoughts?

@leigh-pointer
Copy link
Contributor Author

@sbwalker I think the approach you are outlining sounds more intuitive and that is always a good thing.

@sbwalker sbwalker merged commit e22606a into oqtane:dev Dec 16, 2021
@leigh-pointer leigh-pointer deleted the #1880GetModuleDefinitionSettings branch December 17, 2021 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants