elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.65k stars 8.23k forks source link

[uiSettings] allow update of settings and/or permission management for uiSettings #94668

Open pgayvallet opened 3 years ago

pgayvallet commented 3 years ago

Part of https://github.com/elastic/kibana/issues/48925 Probably related to https://github.com/elastic/kibana/issues/17888

uiSettings can currently only be registered synchronously during the setup phase. Also, there is no way to update a given setting's definition once it has been registered.

It makes registering settings depending on runtime condition impossible. Also, there is no way to update a setting definition or to restrict its usage depending on a variable that may fluctuate in time, such as the license level or license validity.

One usage example would be https://github.com/elastic/kibana/issues/17298, were the banners plugin features are only enabled on gold and higher license. However currently, we don't have any way to specify that the associated ui settings should only be enabled or active when the license level match, meaning that the settings are active and displayed in the advanced settings management section even if the license conditions are not met.

The most generic solution seems to be to provide a way to update the settings definition after their registration. It could be done for example via an update API, or by providing an updater$ observable during the registration, which are both patterns already used in core's code.

Depending on the needs from https://github.com/elastic/kibana/issues/17888, we may also need to just enable permission handling on uiSettings (read/write), which may be complicated given that OSS code is only aware of capabilities and not of things such as the license level. Such feature would probably be leveraging a similar pattern than the CapabilitiesSwitcher we used for capabilities, to let plugins register more global updaters that can mutates all settings.

elasticmachine commented 3 years ago

Pinging @elastic/kibana-core (Team:Core)

elasticmachine commented 1 year ago

Pinging @elastic/appex-sharedux (Team:SharedUX)