Skip to content

Commit

Permalink
fix: do not override user faculty
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed Mar 22, 2024
1 parent 49835da commit d521928
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/client/pages/MainPage/ProductGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const ProductCard = ({
sx={{
mx: 'auto',
px: 4,
mb: 2,
borderRadius: '1rem',
textTransform: 'capitalize',
fontWeight: '600',
Expand Down
8 changes: 7 additions & 1 deletion src/server/util/oicd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ const verifyLogin = async (

const userPreferedFaculty = await getUserFaculties(id, iamGroups)

const userFaculty = await User.findByPk(id, {
attributes: ['preferredFaculty'],
})
const userFacultyCode = userFaculty?.preferredFaculty

const user: UserType = {
username,
id: id || username,
Expand All @@ -78,7 +83,8 @@ const verifyLogin = async (
firstName,
lastName,
isAdmin: checkAdmin(iamGroups) || username === 'glandmic',
preferredFaculty: userPreferedFaculty[0]?.code || 'OTHER',
preferredFaculty:
userFacultyCode || userPreferedFaculty[0]?.code || 'OTHER',
}

await User.upsert({
Expand Down

0 comments on commit d521928

Please sign in to comment.