Improve Capabilities implementation in new platform #51956
Labels
Feature:New Platform
stale
Used to mark issues that were closed for being stale
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
This is a follow-up of #45393
the
Capabilities
feature has been migrated to NP. However, there are some improvements that should still be done:CapabilitiesService
from application and move it as a first class service.Two reasons for this: 1/ this is consistent with server-side. and 2/ capabilities are not really directly related to applications, so it really makes sense to move the capabilities service from applications.
See #51438 (comment)
navLinks
toapplications
navLinks
is the old, legacy term that was only representing the chrome navigation links. In new platform, this is superseeded by ourApplication
concept. We need to replaceCapabilities.navLinks
toCapabilities.application
and perform the associated changes, that are mainly insecurity
andspace
's CapabilitiesSwitchersCurrently capabilities are exposed globally to every plugin. We should probably restrict capabilities accessible to each plugin to only the one they registered. This could be done by keeping track of which plugin registered which capabilities.
Currently the
Capabilities
type is merely a Record of Record<string, boolean>. It would be a big plus to enforce some proper typing around this. I don't think we can strongly type them in core, but at least a typed getter as we do for config would be great.Something like
core.application.capabilities.get<MyPluginCapabilities>()
Due to a lot of usage of capabilities in legacy JS code, that should probably only be addressed post 8.0 when all plugins actually migrated and when we have typescript to back us up for these changes that are going to impact a lot of files.
The text was updated successfully, but these errors were encountered: