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

fix(ACL): UI should display an error when user has no permission to set ACL [#938] #962

Merged
merged 1 commit into from
Feb 3, 2025
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
67 changes: 33 additions & 34 deletions packages/ui/src/ui/store/actions/acl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,44 +287,43 @@ export function requestPermissions(
const poolTree =
idmKind === IdmObjectType.POOL ? normalizedPoolTree || getTree(state) : undefined;

try {
const requestPermissionsPath = await getPathToCheckPermissions(
idmKind,
values.path,
poolTree,
);
const requestPermissionsPath = await getPathToCheckPermissions(
idmKind,
values.path,
poolTree,
);

//cluster, path, roles, comment, columns
return UIFactory.getAclApi()
.requestPermissions({
cluster,
path: values.path,
sysPath: requestPermissionsPath,
roles,
roles_grouped: rolesGroupedBySubject.map(convertFromUIPermissions),
comment: values.comment ?? '',
kind: idmKind,
poolTree,
})
.then(() => {
dispatch({
type: REQUEST_PERMISSION.SUCCESS,
idmKind,
});
});
} catch (error: any) {
if (isCancelled(error)) {
dispatch({type: REQUEST_PERMISSION.CANCELLED, idmKind});
return undefined;
} else {
//cluster, path, roles, comment, columns
return UIFactory.getAclApi()
.requestPermissions({
cluster,
path: values.path,
sysPath: requestPermissionsPath,
roles,
roles_grouped: rolesGroupedBySubject.map(convertFromUIPermissions),
comment: values.comment ?? '',
kind: idmKind,
poolTree,
})
.then(() => {
dispatch({
type: REQUEST_PERMISSION.FAILURE,
data: error,
type: REQUEST_PERMISSION.SUCCESS,
idmKind,
});
return Promise.reject(error);
}
}
})
.catch((error: any) => {
if (isCancelled(error)) {
dispatch({type: REQUEST_PERMISSION.CANCELLED, idmKind});
return undefined;
} else {
dispatch({
type: REQUEST_PERMISSION.FAILURE,
data: error,
idmKind,
});
return Promise.reject(error);
}
});
};
}

Expand Down
Loading