Skip to content

Commit

Permalink
MSFTMPP-339: Fix errors in cron assigning users to application
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcq committed Feb 2, 2016
1 parent 4f90b3d commit 18d76f9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion classes/rest/azuread.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,19 @@ public function assign_user($muserid, $userid, $appobjectid) {
'odata.type' => 'Microsoft.DirectoryServices.AppRoleAssignment',
'objectType' => 'AppRoleAssignment',
);
$response = $this->process_apicall_response($response, $expectedparams);

try {
$response = $this->process_apicall_response($response, $expectedparams);
} catch (\Exception $e) {
// This error here probably means the user is already assigned, so we can continue. process_apicall_response
// will log any real errors anyway.
$msg = 'One or more properties are invalid.';
$string = get_string('erroro365apibadcall_message', 'local_o365', htmlentities($msg));
if ($e->getMessage() !== $string) {
throw $e;
}
}

if (empty($record)) {
$record = new \stdClass;
$record->muserid = $muserid;
Expand Down

0 comments on commit 18d76f9

Please sign in to comment.