From 8512f577dcd75dcc5150a6cd8eaa8a243495df10 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Tue, 12 Aug 2008 13:31:02 +0000 Subject: [PATCH] MDL-15768 - added general capability for exporting any content to portfolio --- lang/en_utf8/role.php | 1 + lib/db/access.php | 12 ++++++++++++ user/tabs.php | 3 +-- version.php | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lang/en_utf8/role.php b/lang/en_utf8/role.php index f2d99f49ef..2f6ba30357 100644 --- a/lang/en_utf8/role.php +++ b/lang/en_utf8/role.php @@ -103,6 +103,7 @@ $string['overriderolesin'] = 'Override roles in $a'; $string['overrides'] = 'Overrides'; $string['permissions'] = 'Permissions'; $string['potentialusers'] = '$a potential users'; +$string['portfolio:export'] = 'Export to portfolios'; $string['prevent'] = 'Prevent'; $string['prohibit'] = 'Prohibit'; $string['question:add'] = 'Add new questions'; diff --git a/lib/db/access.php b/lib/db/access.php index aa12f54ff7..c894b9237b 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -1273,6 +1273,18 @@ $moodle_capabilities = array( 'editingteacher' => CAP_ALLOW, 'coursecreator' => CAP_ALLOW ) + ), + + 'moodle/portfolio:export' => array( + 'captype' => 'read', + 'contextlevel' => CONTEXT_SYSTEM, + 'legacy' => array( + 'user' => CAP_ALLOW, + 'student' => CAP_ALLOW, + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'coursecreator' => CAP_ALLOW + ) ) ); diff --git a/user/tabs.php b/user/tabs.php index d72497c382..c993594b2e 100644 --- a/user/tabs.php +++ b/user/tabs.php @@ -239,12 +239,11 @@ } } - if (empty($userindexpage) && $user->id == $USER->id && !empty($CFG->portfolioenabled)) { + if (empty($userindexpage) && $user->id == $USER->id && !empty($CFG->portfolioenabled) && has_capability('moodle/portfolio:export', get_system_context())) { /// Portfolio tab require_once($CFG->libdir . '/portfoliolib.php'); if (portfolio_instances(true, false)) { - // @todo penny permissions check? $toprow[] = new tabobject('portfolios', $CFG->wwwroot .'/user/portfolio.php', get_string('portfolios', 'portfolio')); } } diff --git a/version.php b/version.php index 4c2b093e64..76ac5411da 100644 --- a/version.php +++ b/version.php @@ -6,7 +6,7 @@ // This is compared against the values stored in the database to determine // whether upgrades should be performed (see lib/db/*.php) - $version = 2008080701; // YYYYMMDD = date of the last version bump + $version = 2008081200; // YYYYMMDD = date of the last version bump // XX = daily increments $release = '2.0 dev (Build: 20080812)'; // Human-friendly version name -- 2.39.5