Merge branch 'MDL-58765-master' of git://github.com/damyon/moodle
This commit is contained in:
@@ -872,6 +872,12 @@ class repository_googledocs extends repository {
|
||||
// finally update the reference to contain the share link if it was not
|
||||
// already there (and point to new file id if we copied).
|
||||
|
||||
// Get the details from the reference.
|
||||
$source = json_decode($reference);
|
||||
if (!empty($source->usesystem)) {
|
||||
// If we already copied this file to the system account - we are done.
|
||||
return $reference;
|
||||
}
|
||||
|
||||
// Check this issuer is enabled.
|
||||
if ($this->disabled) {
|
||||
@@ -895,8 +901,6 @@ class repository_googledocs extends repository {
|
||||
throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
|
||||
}
|
||||
|
||||
// Get the details from the reference.
|
||||
$source = json_decode($reference);
|
||||
$userservice = new repository_googledocs\rest($userauth);
|
||||
$systemservice = new repository_googledocs\rest($systemauth);
|
||||
|
||||
|
||||
@@ -815,6 +815,11 @@ class repository_onedrive extends repository {
|
||||
// then set the permissions so anyone with the share link can view,
|
||||
// finally update the reference to contain the share link if it was not
|
||||
// already there (and point to new file id if we copied).
|
||||
$source = json_decode($reference);
|
||||
if (!empty($source->usesystem)) {
|
||||
// If we already copied this file to the system account - we are done.
|
||||
return $reference;
|
||||
}
|
||||
|
||||
// Get a system and a user oauth client.
|
||||
$systemauth = \core\oauth2\api::get_system_oauth_client($this->issuer);
|
||||
@@ -824,8 +829,6 @@ class repository_onedrive extends repository {
|
||||
throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
|
||||
}
|
||||
|
||||
$source = json_decode($reference);
|
||||
|
||||
$userauth = $this->get_user_oauth_client();
|
||||
if ($userauth === false) {
|
||||
$details = 'Cannot connect as current user';
|
||||
|
||||
Reference in New Issue
Block a user