Commit 311b351f authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Add workaround for PMS OAuth provider giving inconsistently typed school data

parent c2bfbdfc
Pipeline #980 passed with stages
in 17 minutes and 19 seconds
......@@ -1250,6 +1250,15 @@ fn oauth_pms(req: &mut Request, oauth_provider: OauthProvider, school_id: Option
// Unify ambiguous fields
user_data.userId = user_data.userID.or(user_data.userId);
// Workaround for PMS:
if user_data.userType == "t" || user_data.userType == "T" {
if let Some(SchoolIdOrSchoolIds::SchoolId(school_id)) = user_data.schoolId {
let mut v = Vec::new();
v.push(school_id);
user_data.schoolId = Some(SchoolIdOrSchoolIds::SchoolIds(v));
}
}
// Does the user has an array of school (i.e. is he a teacher)?
if let Some(SchoolIdOrSchoolIds::SchoolIds(school_ids)) = user_data.schoolId {
// Has there been a school selected?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment