MDL-58220 repository_onedrive: rename from skydrive

Update all references from skydrive to onedrive in the code / lang strings.
This commit is contained in:
Damyon Wiese
2017-04-03 13:43:27 +08:00
parent 9b8a36e882
commit e518ea7949
12 changed files with 87 additions and 133 deletions
+4 -4
View File
@@ -17,11 +17,11 @@
/**
* Class for loading/storing access records from the DB.
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_skydrive;
namespace repository_onedrive;
defined('MOODLE_INTERNAL') || die();
@@ -30,13 +30,13 @@ use core\persistent;
/**
* Class for loading/storing issuer from the DB
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class access extends persistent {
const TABLE = 'repository_skydrive_access';
const TABLE = 'repository_onedrive_access';
/**
* Return the definition of the properties of this model.
@@ -17,12 +17,12 @@
/**
* A scheduled task.
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_skydrive;
namespace repository_onedrive;
use \core\task\scheduled_task;
@@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die();
/**
* Simple task to delete temporary permission records.
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -42,7 +42,7 @@ class remove_temp_access_task extends scheduled_task {
* @return string
*/
public function get_name() {
return get_string('removetempaccesstask', 'repository_skydrive');
return get_string('removetempaccesstask', 'repository_onedrive');
}
/**
@@ -55,7 +55,7 @@ class remove_temp_access_task extends scheduled_task {
$expires->sub(new DateInterval("P7D"));
$timestamp = $expires->getTimestamp();
$issuerid = get_config('repository_skydrive', 'issuerid');
$issuerid = get_config('repository_onedrive', 'issuerid');
$issuer = \core\oauth2\api::get_issuer_by_id($issuerid);
// Add the current user as an OAuth writer.
@@ -65,7 +65,7 @@ class remove_temp_access_task extends scheduled_task {
$details = 'Cannot connect as system user';
throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
}
$systemservice = new repository_skydrive\rest($systemauth);
$systemservice = new repository_onedrive\rest($systemauth);
foreach ($accessrecords as $access) {
if ($access->get('timemodified') < $timestamp) {
+2 -2
View File
@@ -17,11 +17,11 @@
/**
* Microsoft Graph API Rest Interface.
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_skydrive;
namespace repository_onedrive;
defined('MOODLE_INTERNAL') || die();
+3 -3
View File
@@ -15,15 +15,15 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Capability definitions for skydrive repository
* Capability definitions for onedrive repository
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2012 Lancaster University Network Services Ltd
* @author Dan Poltawski <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$capabilities = array(
'repository/skydrive:view' => array(
'repository/onedrive:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
+1 -1
View File
@@ -17,7 +17,7 @@
/**
* Cache definitions.
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2013 Dan Poltawski <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+2 -2
View File
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="repository/skydrive/db" VERSION="20170314" COMMENT="XMLDB file for Moodle repository/skydrive"
<XMLDB PATH="repository/onedrive/db" VERSION="20170314" COMMENT="XMLDB file for Moodle repository/onedrive"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="repository_skydrive_access" COMMENT="List of temporary access grants.">
<TABLE NAME="repository_onedrive_access" COMMENT="List of temporary access grants.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+3 -3
View File
@@ -15,13 +15,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Definition of repository_skydrive scheduled tasks.
* Definition of repository_onedrive scheduled tasks.
*
* The handlers defined on this file are processed and registered into
* the Moodle DB after any install or upgrade operation. All plugins
* support this.
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -32,7 +32,7 @@ defined('MOODLE_INTERNAL') || die();
$tasks = array(
array(
'classname' => 'repository_skydrive\remove_temp_access_task',
'classname' => 'repository_onedrive\remove_temp_access_task',
'blocking' => 0,
'minute' => 'R',
'hour' => 'R',
+2 -48
View File
@@ -20,59 +20,13 @@ defined('MOODLE_INTERNAL') || die();
* Upgrade this plugin.
*
* @param int $oldversion the version we are upgrading from
* @package repository_skydrive
* @package repository_onedrive
* @return bool result
*/
function xmldb_repository_skydrive_upgrade($oldversion) {
function xmldb_repository_onedrive_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2017031400) {
// Define table repository_skydrive_access to be created.
$table = new xmldb_table('repository_skydrive_access');
// Adding fields to table repository_skydrive_access.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('permissionid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
$table->add_field('itemid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
// Adding keys to table repository_skydrive_access.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('usermodifiedkey', XMLDB_KEY_FOREIGN, array('usermodified'), 'user', array('id'));
// Conditionally launch create table for repository_skydrive_access.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Skydrive savepoint reached.
upgrade_plugin_savepoint(true, 2017031400, 'repository', 'skydrive');
}
if ($oldversion < 2017032800) {
$clientid = get_config('clientid', 'skydrive');
$secret = get_config('secret', 'skydrive');
// Update from repo config to use an OAuth service.
if (!empty($clientid) && !empty($secret)) {
$issuer = \core\oauth2\api::create_standard_issuer('microsoft');
$issuer->set('clientid', $clientid);
$issuer->set('secret', $secret);
$issuer->update();
set_config('issuerid', $issuer->get('id'), 'skydrive');
}
upgrade_plugin_savepoint(true, 2017032800, 'repository', 'skydrive');
}
if ($oldversion < 2017032900) {
set_config('supportedfiles', 'both', 'skydrive');
upgrade_plugin_savepoint(true, 2017032900, 'repository', 'skydrive');
}
return true;
}
+58 -58
View File
@@ -17,7 +17,7 @@
/**
* Microsoft Live Skydrive Repository Plugin
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2012 Lancaster University Network Services Ltd
* @author Dan Poltawski <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -26,14 +26,14 @@
defined('MOODLE_INTERNAL') || die();
/**
* Microsoft skydrive repository plugin.
* Microsoft onedrive repository plugin.
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2012 Lancaster University Network Services Ltd
* @author Dan Poltawski <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class repository_skydrive extends repository {
class repository_onedrive extends repository {
/**
* OAuth 2 client
* @var \core\oauth2\client
@@ -64,7 +64,7 @@ class repository_skydrive extends repository {
parent::__construct($repositoryid, $context, $options, $readonly = 0);
try {
$this->issuer = \core\oauth2\api::get_issuer(get_config('skydrive', 'issuerid'));
$this->issuer = \core\oauth2\api::get_issuer(get_config('onedrive', 'issuerid'));
} catch (dml_missing_record_exception $e) {
$this->disabled = true;
}
@@ -203,7 +203,7 @@ class repository_skydrive extends repository {
*/
public function get_listing($path='', $page = '') {
if (empty($path)) {
$path = $this->build_node_path('root', get_string('pluginname', 'repository_skydrive'));
$path = $this->build_node_path('root', get_string('pluginname', 'repository_onedrive'));
}
if ($this->disabled) {
@@ -224,7 +224,7 @@ class repository_skydrive extends repository {
$id = 'root';
// Append the active path for search.
$str = get_string('searchfor', 'repository_skydrive', $searchtext);
$str = get_string('searchfor', 'repository_onedrive', $searchtext);
$path = $this->build_node_path('search', $str, $path);
}
@@ -252,8 +252,8 @@ class repository_skydrive extends repository {
* @return array of results.
*/
public function search($searchtext, $page = 0) {
$path = $this->build_node_path('root', get_string('pluginname', 'repository_skydrive'));
$str = get_string('searchfor', 'repository_skydrive', $searchtext);
$path = $this->build_node_path('root', get_string('pluginname', 'repository_onedrive'));
$str = get_string('searchfor', 'repository_onedrive', $searchtext);
$path = $this->build_node_path('search', $str, $path);
// Query the Drive.
@@ -295,7 +295,7 @@ class repository_skydrive extends repository {
try {
// Retrieving files and folders.
$client = $this->get_user_oauth_client();
$service = new repository_skydrive\rest($client);
$service = new repository_onedrive\rest($client);
if (!empty($q)) {
$params['search'] = urlencode($q);
@@ -308,7 +308,7 @@ class repository_skydrive extends repository {
}
} catch (Exception $e) {
if ($e->getCode() == 403 && strpos($e->getMessage(), 'Access Not Configured') !== false) {
throw new repository_exception('servicenotenabled', 'repository_skydrive');
throw new repository_exception('servicenotenabled', 'repository_onedrive');
} else {
throw $e;
}
@@ -463,7 +463,7 @@ class repository_skydrive extends repository {
public function supported_returntypes() {
// We can only support references if the system account is connected.
if (!empty($this->issuer) && $this->issuer->is_system_account_connected()) {
$setting = get_config('skydrive', 'supportedreturntypes');
$setting = get_config('onedrive', 'supportedreturntypes');
if ($setting == 'internal') {
return FILE_INTERNAL;
} else if ($setting == 'external') {
@@ -482,8 +482,8 @@ class repository_skydrive extends repository {
* @return int
*/
public function default_returntype() {
$setting = get_config('skydrive', 'defaultreturntype');
$supported = get_config('skydrive', 'supportedreturntypes');
$setting = get_config('onedrive', 'defaultreturntype');
$supported = get_config('onedrive', 'supportedreturntypes');
if (($setting == FILE_INTERNAL && $supported != 'external') || $supported == 'internal') {
return FILE_INTERNAL;
} else {
@@ -545,7 +545,7 @@ class repository_skydrive extends repository {
$details = 'Cannot connect as system user';
throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
}
$systemservice = new repository_skydrive\rest($systemauth);
$systemservice = new repository_onedrive\rest($systemauth);
// Get the user oauth so we can get the account to add.
$url = moodle_url::make_pluginfile_url($storedfile->get_contextid(),
@@ -585,11 +585,11 @@ class repository_skydrive extends repository {
/**
* List the permissions on a file.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fileid The id of the file.
* @return array
*/
protected function list_file_permissions(\repository_skydrive\rest $client, $fileid) {
protected function list_file_permissions(\repository_onedrive\rest $client, $fileid) {
$fields = "id,roles,link,grantedTo";
return $client->call('list_permissions', ['fileid' => $fileid, '$select' => $fields]);
}
@@ -597,11 +597,11 @@ class repository_skydrive extends repository {
/**
* See if a folder exists within a folder
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fullpath
* @return string|boolean The file id if it exists or false.
*/
protected function get_file_id_by_path(\repository_skydrive\rest $client, $fullpath) {
protected function get_file_id_by_path(\repository_onedrive\rest $client, $fullpath) {
$fields = "id";
try {
$response = $client->call('get_file_by_path', ['fullpath' => $fullpath, '$select' => $fields]);
@@ -614,11 +614,11 @@ class repository_skydrive extends repository {
/**
* Delete a file by full path.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fullpath
* @return boolean
*/
protected function delete_file_by_path(\repository_skydrive\rest $client, $fullpath) {
protected function delete_file_by_path(\repository_onedrive\rest $client, $fullpath) {
try {
$response = $client->call('delete_file_by_path', ['fullpath' => $fullpath]);
} catch (\core\oauth2\rest_exception $re) {
@@ -631,11 +631,11 @@ class repository_skydrive extends repository {
/**
* Get a file summary by full path.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fullpath
* @return stdClass
*/
protected function get_file_summary_by_path(\repository_skydrive\rest $client, $fullpath) {
protected function get_file_summary_by_path(\repository_onedrive\rest $client, $fullpath) {
$fields = "folder,id,lastModifiedDateTime,name,size,webUrl,createdByUser";
$response = $client->call('get_file_by_path', ['fullpath' => $fullpath, '$select' => $fields]);
if (empty($response->id)) {
@@ -648,13 +648,13 @@ class repository_skydrive extends repository {
/**
* Create a folder within a folder
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $foldername The folder we are creating.
* @param string $parentid The parent folder we are creating in.
*
* @return string The file id of the new folder.
*/
protected function create_folder_in_folder(\repository_skydrive\rest $client, $foldername, $parentid) {
protected function create_folder_in_folder(\repository_onedrive\rest $client, $foldername, $parentid) {
$params = ['parentid' => $parentid];
$folder = [ 'name' => $foldername, 'folder' => [ 'childCount' => 0 ]];
$created = $client->call('create_folder', $params, json_encode($folder));
@@ -668,12 +668,12 @@ class repository_skydrive extends repository {
/**
* Get simple file info for humans.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fileid The file we are querying.
*
* @return stdClass
*/
protected function get_file_summary(\repository_skydrive\rest $client, $fileid) {
protected function get_file_summary(\repository_onedrive\rest $client, $fileid) {
$fields = "folder,id,lastModifiedDateTime,name,size,webUrl,createdByUser";
$response = $client->call('get', ['fileid' => $fileid, '$select' => $fields]);
return $response;
@@ -682,11 +682,11 @@ class repository_skydrive extends repository {
/**
* Get the id of this users root drive.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
*
* @return string id
*/
protected function get_root_drive_id(\repository_skydrive\rest $client) {
protected function get_root_drive_id(\repository_onedrive\rest $client) {
$response = $client->call('get_drive', []);
if (empty($response->id)) {
@@ -699,12 +699,12 @@ class repository_skydrive extends repository {
/**
* Add a writer to the permissions on the file (temporary).
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fileid The file we are updating.
* @param string $email The email of the writer account to add.
* @return boolean
*/
protected function add_temp_writer_to_file(\repository_skydrive\rest $client, $fileid, $email) {
protected function add_temp_writer_to_file(\repository_onedrive\rest $client, $fileid, $email) {
// Expires in 7 days.
$expires = new DateTime();
$expires->add(new DateInterval("P7D"));
@@ -722,12 +722,12 @@ class repository_skydrive extends repository {
throw new repository_exception('errorwhilecommunicatingwith', 'repository', '', $details);
}
// Store the permission id in the DB. Scheduled task will remove this permission after 7 days.
if ($access = repository_skydrive\access::get_record(['permissionid' => $response->value[0]->id, 'itemid' => $fileid ])) {
if ($access = repository_onedrive\access::get_record(['permissionid' => $response->value[0]->id, 'itemid' => $fileid ])) {
// Update the timemodified.
$access->update();
} else {
$record = (object) [ 'permissionid' => $response->value[0]->id, 'itemid' => $fileid ];
$access = new repository_skydrive\access(0, $record);
$access = new repository_onedrive\access(0, $record);
$access->create();
}
return true;
@@ -736,12 +736,12 @@ class repository_skydrive extends repository {
/**
* Add a writer to the permissions on the file.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fileid The file we are updating.
* @param string $useremail The user email of the writer account to add.
* @return boolean
*/
protected function add_writer_to_file(\repository_skydrive\rest $client, $fileid, $useremail) {
protected function add_writer_to_file(\repository_onedrive\rest $client, $fileid, $useremail) {
$updateeditor = [
'recipients' => [ [ 'email' => $useremail ] ],
'roles' => ['write'],
@@ -760,11 +760,11 @@ class repository_skydrive extends repository {
/**
* Allow anyone with the link to read the file.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $fileid The file we are updating.
* @return boolean
*/
protected function set_file_sharing_anyone_with_link_can_read(\repository_skydrive\rest $client, $fileid) {
protected function set_file_sharing_anyone_with_link_can_read(\repository_onedrive\rest $client, $fileid) {
$updateread = [
'type' => 'view',
'scope' => 'anonymous'
@@ -781,13 +781,13 @@ class repository_skydrive extends repository {
/**
* Copy a shared file to a new folder.
*
* @param \repository_skydrive\rest $client Authenticated client.
* @param \repository_onedrive\rest $client Authenticated client.
* @param string $sharetoken The share we are querying.
* @param string $newdrive Id of the drive to copy to.
* @param string $parentid Id of the folder to copy to.
* @return stdClass
*/
protected function copy_share(\repository_skydrive\rest $client, $sharetoken, $newdrive, $parentid) {
protected function copy_share(\repository_onedrive\rest $client, $sharetoken, $newdrive, $parentid) {
$folder = [
'parentReference' => ['id' => $parentid, 'driveId' => $newdrive]
];
@@ -857,8 +857,8 @@ class repository_skydrive extends repository {
$userinfo = $userauth->get_userinfo();
$useremail = $userinfo['email'];
$userservice = new repository_skydrive\rest($userauth);
$systemservice = new repository_skydrive\rest($systemauth);
$userservice = new repository_onedrive\rest($userauth);
$systemservice = new repository_onedrive\rest($systemauth);
// Get the list of existing permissions so we can see if the owner is already the system account,
// and whether we need to update the link sharing options.
@@ -883,7 +883,7 @@ class repository_skydrive extends repository {
// Now copy it to a sensible folder.
$contextlist = array_reverse($context->get_parent_contexts(true));
$cache = cache::make('repository_skydrive', 'folder');
$cache = cache::make('repository_onedrive', 'folder');
$parentid = 'root';
$fullpath = '';
$allfolders = [];
@@ -966,7 +966,7 @@ class repository_skydrive extends repository {
if ($systemauth === false) {
return '';
}
$systemservice = new repository_skydrive\rest($systemauth);
$systemservice = new repository_onedrive\rest($systemauth);
$info = $this->get_file_summary($systemservice, $source->id);
$owner = '';
@@ -974,7 +974,7 @@ class repository_skydrive extends repository {
$owner = $info->createdByUser->displayName;
}
if ($owner) {
return get_string('owner', 'repository_skydrive', $owner);
return get_string('owner', 'repository_onedrive', $owner);
} else {
return $info->name;
}
@@ -990,7 +990,7 @@ class repository_skydrive extends repository {
$url = new moodle_url('/admin/tool/oauth2/issuers.php');
$url = $url->out();
$mform->addElement('static', null, '', get_string('oauth2serviceslink', 'repository_skydrive', $url));
$mform->addElement('static', null, '', get_string('oauth2serviceslink', 'repository_onedrive', $url));
parent::type_config_form($mform);
$options = [];
@@ -1002,23 +1002,23 @@ class repository_skydrive extends repository {
$strrequired = get_string('required');
$mform->addElement('select', 'issuerid', get_string('issuer', 'repository_skydrive'), $options);
$mform->addHelpButton('issuerid', 'issuer', 'repository_skydrive');
$mform->addElement('select', 'issuerid', get_string('issuer', 'repository_onedrive'), $options);
$mform->addHelpButton('issuerid', 'issuer', 'repository_onedrive');
$mform->addRule('issuerid', $strrequired, 'required', null, 'client');
$mform->addElement('static', null, '', get_string('fileoptions', 'repository_skydrive'));
$mform->addElement('static', null, '', get_string('fileoptions', 'repository_onedrive'));
$choices = [
'internal' => get_string('internal', 'repository_skydrive'),
'external' => get_string('external', 'repository_skydrive'),
'both' => get_string('both', 'repository_skydrive')
'internal' => get_string('internal', 'repository_onedrive'),
'external' => get_string('external', 'repository_onedrive'),
'both' => get_string('both', 'repository_onedrive')
];
$mform->addElement('select', 'supportedreturntypes', get_string('supportedreturntypes', 'repository_skydrive'), $choices);
$mform->addElement('select', 'supportedreturntypes', get_string('supportedreturntypes', 'repository_onedrive'), $choices);
$choices = [
FILE_INTERNAL => get_string('internal', 'repository_skydrive'),
FILE_CONTROLLED_LINK => get_string('external', 'repository_skydrive'),
FILE_INTERNAL => get_string('internal', 'repository_onedrive'),
FILE_CONTROLLED_LINK => get_string('external', 'repository_onedrive'),
];
$mform->addElement('select', 'defaultreturntype', get_string('defaultreturntype', 'repository_skydrive'), $choices);
$mform->addElement('select', 'defaultreturntype', get_string('defaultreturntype', 'repository_onedrive'), $choices);
}
}
@@ -1028,9 +1028,9 @@ class repository_skydrive extends repository {
* @param \core\oauth2\issuer $issuer
* @return string
*/
function repository_skydrive_oauth2_system_scopes(\core\oauth2\issuer $issuer) {
if ($issuer->get('id') == get_config('skydrive', 'issuerid')) {
return repository_skydrive::SCOPES;
function repository_onedrive_oauth2_system_scopes(\core\oauth2\issuer $issuer) {
if ($issuer->get('id') == get_config('onedrive', 'issuerid')) {
return repository_onedrive::SCOPES;
}
return '';
}
+3 -3
View File
@@ -15,9 +15,9 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Version details for skydrive repository
* Version details for onedrive repository
*
* @package repository_skydrive
* @package repository_onedrive
* @copyright 2012 Lancaster University Network Services Ltd
* @author Dan Poltawski <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -27,4 +27,4 @@ defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017032900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016112900; // Requires this Moodle version.
$plugin->component = 'repository_skydrive'; // Full name of the plugin (used for diagnostics).
$plugin->component = 'repository_onedrive'; // Full name of the plugin (used for diagnostics).
@@ -24,8 +24,8 @@
*/
$string['cachedef_foldername'] = 'Folder name cache';
$string['clientid'] = 'Client ID';
$string['configplugin'] = 'Configure Microsoft OneDrive';
$string['configplugin'] = 'Configure Microsoft SkyDrive';
$string['oauthinfo'] = '<p>To use this plugin, you must register your site <a href="https://account.live.com/developers/applications">with Microsoft</a>.<p>As part of the registration process, you will need to enter the following URL as \'Redirect domain\':</p><p>{$a->callbackurl}</p>Once registered, you will be provided with a client ID and secret which can be entered here.</p>';
$string['pluginname'] = 'Microsoft OneDrive';
$string['pluginname'] = 'Microsoft SkyDrive';
$string['secret'] = 'Secret';
$string['skydrive:view'] = 'View OneDrive';
$string['skydrive:view'] = 'View SkyDrive';