mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Enterprise Search: handle optional spaces plugin (#153230)
## Summary Updated spaces to be an optional plugin
This commit is contained in:
parent
b616950d07
commit
fd8508a4f0
4 changed files with 17 additions and 7 deletions
|
@ -12,7 +12,6 @@
|
|||
],
|
||||
"requiredPlugins": [
|
||||
"features",
|
||||
"spaces",
|
||||
"security",
|
||||
"licensing",
|
||||
"data",
|
||||
|
@ -26,10 +25,11 @@
|
|||
"embeddable",
|
||||
],
|
||||
"optionalPlugins": [
|
||||
"usageCollection",
|
||||
"home",
|
||||
"customIntegrations",
|
||||
"ml"
|
||||
"home",
|
||||
"ml",
|
||||
"spaces",
|
||||
"usageCollection"
|
||||
],
|
||||
"requiredBundles": [
|
||||
"kibanaReact",
|
||||
|
|
|
@ -118,6 +118,16 @@ describe('checkAccess', () => {
|
|||
expect(expectedError).toEqual('Error');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when spaces plugin is not available', () => {
|
||||
it('should not throw', async () => {
|
||||
await expect(checkAccess({ ...mockDependencies, spaces: undefined })).resolves.toEqual({
|
||||
hasAppSearchAccess: false,
|
||||
hasSearchEnginesAccess: false,
|
||||
hasWorkplaceSearchAccess: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the space is enabled', () => {
|
||||
|
|
|
@ -18,7 +18,7 @@ import { callEnterpriseSearchConfigAPI } from './enterprise_search_config_api';
|
|||
interface CheckAccess {
|
||||
request: KibanaRequest;
|
||||
security: SecurityPluginSetup;
|
||||
spaces: SpacesPluginStart;
|
||||
spaces?: SpacesPluginStart;
|
||||
config: ConfigType;
|
||||
log: Logger;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ export const checkAccess = async ({
|
|||
}
|
||||
|
||||
// We can only retrieve the active space when security is enabled and the request has already been authenticated
|
||||
const attemptSpaceRetrieval = request.auth.isAuthenticated;
|
||||
const attemptSpaceRetrieval = request.auth.isAuthenticated && !!spaces;
|
||||
let allowedAtSpace = false;
|
||||
|
||||
if (attemptSpaceRetrieval) {
|
||||
|
|
|
@ -89,7 +89,7 @@ interface PluginsSetup {
|
|||
}
|
||||
|
||||
interface PluginsStart {
|
||||
spaces: SpacesPluginStart;
|
||||
spaces?: SpacesPluginStart;
|
||||
security: SecurityPluginStart;
|
||||
data: DataPluginStart;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue