-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: Removes success notification on faking a success response for `se…
…lf` (#4906) In order to continue supporting the legacy ACL system, we replace the 500 error from a non-existent `self` endpoint with a response of a `null` `AccessorID` - which makes sense (a null AccessorID means old API) We then redirect the user to the old ACL pages which then gives a 403 if their token was wrong which then redirects them back to the login page. Due to the multiple redirects and not wanting to test the validity of the token before redirecting (thus calling the same API endpoint twice), it is not straightforwards to turn the 'faked' response from the `self` endpoint into an error (flash messages are 'lost' through multiple redirects). In order to make this a slightly better experience, you can now return a `false` during execution of an action requiring success/failure feedback, this essentially skips the notification, so if the action is 'successful' but you don't want to show the notification, you can. This resolves showing a successful notification when the `self` endpoint response is faked. The last part of the puzzle is to make sure that the global 403 catching error in the application Route also produces an erroneous notification. Please note this can only happen with a ui client using the new ACL system when communicating with a cluster using the old ACL system, and only when you enter the wrong token. Lastly, further acceptance tests have been added around this This commit also adds functionality to avoid any possible double notification messages, to avoid UI overlapping
- Loading branch information
Showing
9 changed files
with
158 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
ui-v2/tests/acceptance/dc/acls/tokens/login-errors.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@setupApplicationTest | ||
Feature: dc / acls / tokens / index: ACL Login Errors | ||
|
||
Scenario: I get any 500 error that is not the specific legacy token cluster one | ||
Given 1 datacenter model with the value "dc-1" | ||
Given the url "/v1/acl/tokens" responds with a 500 status | ||
When I visit the tokens page for yaml | ||
--- | ||
dc: dc-1 | ||
--- | ||
Then the url should be /dc-1/acls/tokens | ||
Then I see the text "500 (The backend responded with an error)" in "[data-test-error]" | ||
Scenario: I get a 500 error from acl/tokens that is the specific legacy one | ||
Given 1 datacenter model with the value "dc-1" | ||
And the url "/v1/acl/tokens" responds with from yaml | ||
--- | ||
status: 500 | ||
body: "rpc error making call: rpc: can't find method ACL.TokenRead" | ||
--- | ||
When I visit the tokens page for yaml | ||
--- | ||
dc: dc-1 | ||
--- | ||
Then the url should be /dc-1/acls/tokens | ||
Then ".app-view" has the "unauthorized" class | ||
Scenario: I get a 500 error from acl/token/self that is the specific legacy one | ||
Given 1 datacenter model with the value "dc-1" | ||
Given the url "/v1/acl/tokens" responds with from yaml | ||
--- | ||
status: 500 | ||
body: "rpc error making call: rpc: can't find method ACL.TokenRead" | ||
--- | ||
And the url "/v1/acl/token/self" responds with from yaml | ||
--- | ||
status: 500 | ||
body: "rpc error making call: rpc: can't find method ACL.TokenRead" | ||
--- | ||
And the url "/v1/acl/list" responds with a 403 status | ||
When I visit the tokens page for yaml | ||
--- | ||
dc: dc-1 | ||
--- | ||
Then the url should be /dc-1/acls/tokens | ||
Then ".app-view" has the "unauthorized" class | ||
Then I fill in with yaml | ||
--- | ||
secret: something | ||
--- | ||
And I submit | ||
Then ".app-view" has the "unauthorized" class | ||
And "[data-notification]" has the "error" class | ||
|
10 changes: 10 additions & 0 deletions
10
ui-v2/tests/acceptance/steps/dc/acls/tokens/login-errors-steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import steps from '../../../steps'; | ||
|
||
// step definitions that are shared between features should be moved to the | ||
// tests/acceptance/steps/steps.js file | ||
|
||
export default function(assert) { | ||
return steps(assert).then('I should find a file', function() { | ||
assert.ok(true, this.step); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters