Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[MDL-31708] - wiki 2.0 non-group member can see edit option in naviga…

…tion block.
  • Loading branch information...
commit ebadb9b9a674f5e91ddb7460ea3f9dafc6c34523 1 parent cb0a069
@leblangi leblangi authored nebgor committed
View
2  mod/wiki/lang/en/wiki.php
@@ -22,8 +22,10 @@
$string['backpage'] = 'Back to page';
$string['backtomapmenu'] = 'Back to map menu';
$string['changerate'] = 'Do you wish to change it?';
+$string['cannoteditpage'] = 'You can not edit this page.';
$string['cannotmanagefiles'] = 'You don\'t have permission to manage the wiki files.';
$string['cannotviewfiles'] = 'You don\'t have permission to view the wiki files.';
+$string['cannotviewpage'] = 'You can not view this page.';
$string['comparesel'] = 'Compare selected';
$string['comments'] = 'Comments';
$string['commentscount'] = 'Comments ({$a})';
View
2  mod/wiki/lib.php
@@ -543,7 +543,7 @@ function wiki_extend_navigation(navigation_node $navref, $course, $module, $cm)
$node = $navref->add(get_string('view', 'wiki'), $link, navigation_node::TYPE_SETTING);
}
- if (has_capability('mod/wiki:editpage', $context)) {
+ if (wiki_user_can_edit($subwiki)) {
$link = new moodle_url('/mod/wiki/edit.php', array('pageid' => $pageid));
$node = $navref->add(get_string('edit', 'wiki'), $link, navigation_node::TYPE_SETTING);
}
View
2  mod/wiki/locallib.php
@@ -764,7 +764,7 @@ function wiki_user_can_view($subwiki) {
// Each person owns a wiki.
if ($wiki->wikimode == 'collaborative' || $wiki->wikimode == 'individual') {
// Only members of subwiki group could view that wiki
- if ($subwiki->groupid == groups_get_activity_group($cm)) {
+ if (groups_is_member($subwiki->groupid)) {
// Only view capability needed
return has_capability('mod/wiki:viewpage', $context);
View
10 mod/wiki/pagelib.php
@@ -172,10 +172,6 @@ protected function setup_tabs($options = array()) {
if (!$manage and !($edit and groups_is_member($currentgroup))) {
unset($this->tabs['edit']);
}
- } else {
- if (!has_capability('mod/wiki:editpage', $PAGE->context)) {
- unset($this->tabs['edit']);
- }
}
@@ -324,8 +320,7 @@ function print_content() {
}
}
} else {
- // @TODO: Tranlate it
- echo "You can not view this page";
+ echo get_string('cannotviewpage', 'wiki');
}
}
@@ -418,8 +413,7 @@ function print_content() {
if (wiki_user_can_edit($this->subwiki)) {
$this->print_edit();
} else {
- // @TODO: Translate it
- echo "You can not edit this page";
+ echo get_string('cannoteditpage', 'wiki');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.