Skip to content

Commit 3544286

Browse files
committed
login-as: Do not assume everyone has shibbolethId
1 parent 83eccb9 commit 3544286

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

backend/src/services/PersonService.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,12 @@ export const searchPersons = async (userQuery) => {
190190
if (userQuery.split(' ').length === 2) {
191191
const firstName = userQuery.split(' ')[0]
192192
const lastName = userQuery.split(' ')[1]
193-
query = qb => qb.where('firstname', 'iLIKE', `%${firstName}%`)
193+
query = qb => qb.whereNotNull('shibbolethId')
194+
.andWhere('firstname', 'iLIKE', `%${firstName}%`)
194195
.andWhere('lastname', 'iLIKE', `%${lastName}%`)
195196
} else {
196-
query = qb => qb.where('email', 'iLIKE', `%${userQuery}%`)
197+
query = qb => qb.whereNotNull('shibbolethId')
198+
.andWhere('email', 'iLIKE', `%${userQuery}%`)
197199
.orWhere('firstname', 'iLIKE', `%${userQuery}%`)
198200
.orWhere('lastname', 'iLIKE', `%${userQuery}%`)
199201
}

frontend/src/containers/Person/components/PersonSwitcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class PersonSwitcher extends Component {
4040

4141
<ul style={{ padding: 10, margin: 0 }}>
4242
{this.state.persons.map(person => (
43-
<div key={person.shibbolethId}>
43+
<div key={person.shibbolethId || person.personId}>
4444
<button
4545
style={{ margin: 5 }}
4646
className="ui white button"

0 commit comments

Comments
 (0)