Skip to content

Commit

Permalink
login-as: Do not assume everyone has shibbolethId
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksTeresh committed Mar 20, 2024
1 parent 83eccb9 commit 3544286
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backend/src/services/PersonService.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,12 @@ export const searchPersons = async (userQuery) => {
if (userQuery.split(' ').length === 2) {
const firstName = userQuery.split(' ')[0]
const lastName = userQuery.split(' ')[1]
query = qb => qb.where('firstname', 'iLIKE', `%${firstName}%`)
query = qb => qb.whereNotNull('shibbolethId')
.andWhere('firstname', 'iLIKE', `%${firstName}%`)
.andWhere('lastname', 'iLIKE', `%${lastName}%`)
} else {
query = qb => qb.where('email', 'iLIKE', `%${userQuery}%`)
query = qb => qb.whereNotNull('shibbolethId')
.andWhere('email', 'iLIKE', `%${userQuery}%`)
.orWhere('firstname', 'iLIKE', `%${userQuery}%`)
.orWhere('lastname', 'iLIKE', `%${userQuery}%`)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PersonSwitcher extends Component {

<ul style={{ padding: 10, margin: 0 }}>
{this.state.persons.map(person => (
<div key={person.shibbolethId}>
<div key={person.shibbolethId || person.personId}>
<button
style={{ margin: 5 }}
className="ui white button"
Expand Down

0 comments on commit 3544286

Please sign in to comment.