Skip to content

Commit

Permalink
Merge branch 'wip-83688-m40' into MOODLE_40_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
weilai-irl committed May 11, 2022
2 parents 39adcc1 + 7e66e94 commit c43596e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
33 changes: 24 additions & 9 deletions local/o365/classes/feature/sds/task/sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,30 @@ public static function runsync(unified $apiclient) : bool {
$studentstudentnumber = '';
$teacherexternalid = '';
$teacherteachernumber = '';
if (array_key_exists('student', $processedschooluser)) {
$studentexternalid = $processedschooluser['student']['externalId'];
$studentbirthdate = $processedschooluser['student']['birthDate'];
$studentgrade = $processedschooluser['student']['grade'];
$studentgraduationyear = $processedschooluser['student']['graduationYear'];
$studentstudentnumber = $processedschooluser['student']['studentNumber'];
} else if (array_key_exists('teacher', $processedschooluser)) {
$teacherexternalid = $processedschooluser['teacher']['externalId'];
$teacherteachernumber = $processedschooluser['teacher']['teacherNumber'];
if ($primaryrole == 'student' && isset($processedschooluser['student'])) {
if (isset($processedschooluser['student']['externalId'])) {
$studentexternalid = $processedschooluser['student']['externalId'];
}
if (isset($processedschooluser['student']['birthDate'])) {
$studentbirthdate = $processedschooluser['student']['birthDate'];
}
if (isset($processedschooluser['student']['grade'])) {
$studentgrade = $processedschooluser['student']['grade'];
}
if (isset($processedschooluser['student']['graduationYear'])) {
$studentgraduationyear = $processedschooluser['student']['graduationYear'];
}
if (isset($processedschooluser['student']['studentNumber'])) {
$studentstudentnumber = $processedschooluser['student']['studentNumber'];
}
}
if ($primaryrole == 'teacher' && isset($processedschooluser['teacher'])) {
if (isset($processedschooluser['teacher']['externalId'])) {
$teacherexternalid = $processedschooluser['teacher']['externalId'];
}
if (isset($processedschooluser['teacher']['teacherNumber'])) {
$teacherteachernumber = $processedschooluser['teacher']['teacherNumber'];
}
}

foreach ($additionalprofilemappings as $remotefield => $localfield) {
Expand Down
3 changes: 2 additions & 1 deletion local/o365/lang/en/local_o365.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@
$string['settings_sds_profilesync_disabled'] = 'Disabled';
$string['settings_sds_profilesync'] = 'Sync profile data from school';
$string['settings_sds_profilesync_desc'] = 'Select the SDS school from which Moodle synchronises SDS specific profile data.<br/>
Note synchronisation of SDS fields will only happen when running the "Sync with SDS" scheduled task, and will not happen when running the "Sync users with Azure AD" scheduled task, nor when user logs in.';
Note synchronisation of SDS fields will only happen when running the "Sync with SDS" scheduled task, and will not happen when running the "Sync users with Azure AD" scheduled task, nor when user logs in.<br/>
Note there is a known issue in Microsoft Graph API used by this feature that certain student and teacher school profile fields are not returned, therefore are unavilable to sync even when configured.';
$string['settings_sds_noschools'] = '<div class="alert alert-info">You do not have any schools available in School data sync.</div>';
$string['settings_sds_get_schools_error'] = '<div class="alert alert-info error">Failed to get SDS schools. Check the Azure app has required permission.</div>';
$string['settings_sds_school_disabled_action'] = 'School sync disabled action';
Expand Down

0 comments on commit c43596e

Please sign in to comment.