Skip to content

Commit

Permalink
Make sure nonexistent user group not change the permission of current…
Browse files Browse the repository at this point in the history
… admin permission (opendatahub-io#953)
  • Loading branch information
DaoDaoNoCode authored and lucferbux committed Mar 13, 2023
1 parent cbb4a93 commit e8cd3ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/src/utils/adminUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ const checkUserInGroups = async (
groupList: string[],
userName: string,
): Promise<boolean> => {
try {
for (const group of groupList) {
for (const group of groupList) {
try {
const groupUsers = await getGroup(customObjectApi, group);
if (
groupUsers?.includes(userName) ||
groupUsers?.includes(`${KUBE_SAFE_PREFIX}${userName}`)
) {
return true;
}
} catch (e) {
fastify.log.error(e.toString());
}
} catch (e) {
fastify.log.error(e.toString());
}
return false;
};

0 comments on commit e8cd3ba

Please sign in to comment.