Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZKUI-284 - Fix account conflict to access account page #497

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/react/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,17 @@ export const useAccounts = () => {
if (!error) {
dispatch(networkEnd());
if (accountsWithRoles?.entries) {
accountsWithRoles.forEach((accountWithRoles) => {
redirectDataConsumers(accountWithRoles.Roles);
});
/**
* When a OIDC user has at least one account that has the right
* access right to Account page, it will display the page.
* Otherwise the user will be redirected to `/buckets`
* However, it does not means that all accounts can perform all
* tasks in Account page.
*/
const allRoles = accountsWithRoles.flatMap(
(accWithRoles) => accWithRoles.Roles,
);
redirectDataConsumers(allRoles);
}
} else {
if (error?.message === 'Unmounted') {
Expand Down