Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-8490 Glossary student not being able to edit entries; backported …

…from HEAD
  • Loading branch information...
commit f167056a1846024eff3a806af79865750b461c7c 1 parent 375016e
skodak authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 mod/glossary/edit.php
View
12 mod/glossary/edit.php
@@ -32,8 +32,16 @@
error("Course module is incorrect");
}
-if ($e) { // if entry is sepcified
- require_capability('mod/glossary:manageentries', $context);
+
+if ($e) { // if entry is specified
+ if (!$entry = get_record("glossary_entries", "id", $e)) {
+ error("Incorrect entry id");
+ }
+ $ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
+ if (!has_capability('mod/glossary:manageentries', $context) and !($entry->userid == $USER->id and ($ineditperiod and has_capability('mod/glossary:write', $context)))) {
+ //expired edit time is the most probable cause here
+ error(get_string('erredittimeexpired', 'glossary'), "view.php?id=$cm->id&amp;mode=entry&amp;hook=$e");
+ }
} else { // new entry
require_capability('mod/glossary:write', $context);
}
Please sign in to comment.
Something went wrong with that request. Please try again.