From 3efae234fa9818b2a34726fcda1ad5823caaebb8 Mon Sep 17 00:00:00 2001 From: scyrma Date: Mon, 28 Apr 2008 08:27:10 +0000 Subject: [PATCH] MDL-14150 - Make tag:edit and tag:manage more distinct - related tags and description are now editing, renaming is managing. (merge from 1.9) --- tag/edit.php | 10 ++++++---- tag/locallib.php | 6 ++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tag/edit.php b/tag/edit.php index 3da6fc6332..1939f1aab4 100644 --- a/tag/edit.php +++ b/tag/edit.php @@ -69,7 +69,7 @@ if ($tagnew = $tagform->get_data()) { } } - if (!has_capability('moodle/tag:manage', $systemcontext)) { + if (!has_capability('moodle/tag:manage', $systemcontext) && !has_capability('moodle/tag:edit', $systemcontext)) { unset($tagnew->name); unset($tagnew->rawname); @@ -87,9 +87,11 @@ if ($tagnew = $tagform->get_data()) { $tagnew->timemodified = time(); - // rename tag if needed - if (!tag_rename($tag->id, $tagnew->rawname)) { - print_error('Error updating tag record'); + if (has_capability('moodle/tag:manage', $systemcontext)) { + // rename tag + if(!tag_rename($tag->id, $tagnew->rawname)) { + error('Error updating tag record'); + } } //updated related tags diff --git a/tag/locallib.php b/tag/locallib.php index 934d3c8bc0..2a274133c4 100644 --- a/tag/locallib.php +++ b/tag/locallib.php @@ -177,13 +177,11 @@ function tag_print_management_box($tag_object, $return=false) { $links[] = ''. get_string('flagasinappropriate', 'tag', rawurlencode($tagname)) .''; // Edit tag: Only people with moodle/tag:edit capability who either have it as an interest or can manage tags - if (has_capability('moodle/tag:edit', $systemcontext) && - (tag_record_tagged_with('user', $USER->id, $tag_object->name) || - has_capability('moodle/tag:manage', $systemcontext))) { + if (has_capability('moodle/tag:edit', $systemcontext) || + has_capability('moodle/tag:manage', $systemcontext)) { $links[] = ''. get_string('edittag', 'tag') .''; } - $output .= implode(' | ', $links); $output .= print_box_end(true); } -- 2.39.5