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 (#953)
  • Loading branch information
DaoDaoNoCode authored Mar 9, 2023
1 parent 3b5c7b8 commit a9513ae
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 a9513ae

Please sign in to comment.