"MDL-19181, display plugin instances based on capabilities"

This commit is contained in:
dongsheng 2009-08-07 10:02:47 +00:00
parent 68bd9e5e13
commit c86dde2ec5
66 changed files with 584 additions and 39 deletions

View file

@ -0,0 +1,15 @@
<?php
$repository_alfresco_capabilities = array(
'repository/alfresco:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_alfresco_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 20090080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_boxnet_capabilities = array(
'repository/boxnet:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_boxnet_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

2
repository/boxnet/version.php Executable file
View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080104;

View file

@ -0,0 +1,15 @@
<?php
$repository_draft_capabilities = array(
'repository/draft:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -1,2 +1,2 @@
<?php
$plugin->version = 2009062000;
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_filesystem_capabilities = array(
'repository/filesystem:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_filesystem_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_flickr_capabilities = array(
'repository/flickr:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_flickr_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_googledocs_capabilities = array(
'repository/googledocs:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_googledocs_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -623,6 +623,7 @@ abstract class repository {
$is_supported = true;
$repository = new $classname($repo->id, $repo->contextid, $options, $repo->readonly);
$context = get_context_instance_by_id(CONTEXT_SYSTEM, $repo->contextid);
if (empty($repository->super_called)) {
debugging('parent::__construct must be called by '.$repo->repositorytype.' plugin.');
} else {
@ -645,7 +646,8 @@ abstract class repository {
if (!$onlyvisible || ($repository->is_visible() && !$repository->disabled)) {
// super_called will make sure the parent construct function is called
// by repository construct function
if ($is_supported) {
$capability = has_capability('repository/'.$repo->repositorytype.':view', $context, $USER->id, false);
if ($is_supported && $capability) {
$ret[] = $repository;
}
}

View file

@ -0,0 +1,15 @@
<?php
$repository_local_capabilities = array(
'repository/local:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -1,2 +1,2 @@
<?php
$plugin->version = 2009052000;
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_mahara_capabilities = array(
'repository/mahara:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_mahara_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_picasa_capabilities = array(
'repository/picasa:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_picasa_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_remotemoodle_capabilities = array(
'repository/remotemoodle:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_remotemoodle_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_s3_capabilities = array(
'repository/s3:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_s3_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_upload_capabilities = array(
'repository/upload:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -69,7 +69,7 @@ class repository_upload extends repository {
* @return string
*/
public function get_name(){
return get_string('repositoryname', 'repository_upload');;
return get_string('repositoryname', 'repository_upload');
}
}
?>

View file

@ -1,2 +1,2 @@
<?php
$plugin->version = 2009031000;
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_url_capabilities = array(
'repository/url:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_url_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -1,2 +1,2 @@
<?php
$plugin->version = 2009051800;
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_webdav_capabilities = array(
'repository/webdav:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_webdav_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_wikimedia_capabilities = array(
'repository/wikimedia:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_wikimedia_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;

View file

@ -0,0 +1,15 @@
<?php
$repository_youtube_capabilities = array(
'repository/youtube:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'admin' => CAP_ALLOW
)
)
);

View file

@ -0,0 +1,20 @@
<?php
function xmldb_repository_youtube_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// }
return $result;
}

View file

@ -0,0 +1,2 @@
<?php
$plugin->version = 2009080101;