Skip to content

Commit

Permalink
Change redirect behavior (404 instead of space selector) when user is…
Browse files Browse the repository at this point in the history
… not authorized to access particular space (needs discussion).
  • Loading branch information
azasypkin committed Oct 28, 2019
1 parent 5feb3a1 commit b42eab3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
expect(uiCapabilities.value!.catalogue).to.eql(expected);
break;
}
// if we don't have access at the space itself, we're
// redirected to the space selector and the ui capabilities
// are lagely irrelevant because they won't be consumed
// if we don't have access at the space itself, security interceptor responds with 404.
case 'no_kibana_privileges at everything_space':
case 'no_kibana_privileges at nothing_space':
case 'legacy_all at everything_space':
Expand All @@ -78,9 +76,7 @@ export default function catalogueTests({ getService }: FtrProviderContext) {
case 'nothing_space_all at everything_space':
case 'nothing_space_read at everything_space':
expect(uiCapabilities.success).to.be(false);
expect(uiCapabilities.failureReason).to.be(
GetUICapabilitiesFailureReason.RedirectedToSpaceSelector
);
expect(uiCapabilities.failureReason).to.be(GetUICapabilitiesFailureReason.NotFound);
break;
default:
throw new UnreachableError(scenario);
Expand Down
8 changes: 2 additions & 6 deletions x-pack/test/ui_capabilities/security_and_spaces/tests/foo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export default function fooTests({ getService }: FtrProviderContext) {
show: false,
});
break;
// if we don't have access at the space itself, we're
// redirected to the space selector and the ui capabilities
// are largely irrelevant because they won't be consumed
// if we don't have access at the space itself, security interceptor responds with 404.
case 'no_kibana_privileges at everything_space':
case 'no_kibana_privileges at nothing_space':
case 'legacy_all at everything_space':
Expand All @@ -82,9 +80,7 @@ export default function fooTests({ getService }: FtrProviderContext) {
case 'nothing_space_all at everything_space':
case 'nothing_space_read at everything_space':
expect(uiCapabilities.success).to.be(false);
expect(uiCapabilities.failureReason).to.be(
GetUICapabilitiesFailureReason.RedirectedToSpaceSelector
);
expect(uiCapabilities.failureReason).to.be(GetUICapabilitiesFailureReason.NotFound);
break;
default:
throw new UnreachableError(scenario);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
expect(uiCapabilities.value).to.have.property('navLinks');
expect(uiCapabilities.value!.navLinks).to.eql(navLinksBuilder.only('management'));
break;
// if we don't have access at the space itself, security interceptor responds with 404.
case 'no_kibana_privileges at everything_space':
case 'no_kibana_privileges at nothing_space':
case 'legacy_all at everything_space':
Expand All @@ -71,9 +72,7 @@ export default function navLinksTests({ getService }: FtrProviderContext) {
case 'nothing_space_all at everything_space':
case 'nothing_space_read at everything_space':
expect(uiCapabilities.success).to.be(false);
expect(uiCapabilities.failureReason).to.be(
GetUICapabilitiesFailureReason.RedirectedToSpaceSelector
);
expect(uiCapabilities.failureReason).to.be(GetUICapabilitiesFailureReason.NotFound);
break;
default:
throw new UnreachableError(scenario);
Expand Down

0 comments on commit b42eab3

Please sign in to comment.