Skip to content

Commit 98bd509

Browse files
committed
Only api_is_allowed_to_edit() users can create groups see BT#10948
1 parent 3a3b76a commit 98bd509

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

main/group/group_creation.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
// Notice for unauthorized people.
1616
api_protect_course_script(true);
1717

18-
/* Create the groups */
18+
if (!api_is_allowed_to_edit(false, true)) {
19+
api_not_allowed(true);
20+
}
1921

22+
/* Create the groups */
2023
if (isset($_POST['action'])) {
2124
switch ($_POST['action']) {
2225
case 'create_groups':
@@ -79,15 +82,8 @@
7982
$interbreadcrumb[] = array ('url' => 'group.php', 'name' => get_lang('Groups'));
8083
Display :: display_header($nameTools, 'Group');
8184

82-
if (!api_is_allowed_to_edit(false, true)) {
83-
api_not_allowed();
84-
}
85-
86-
/* MAIN TOOL CODE */
87-
8885
/* Show group-settings-form */
89-
90-
elseif (isset($_POST['number_of_groups'])) {
86+
if (isset($_POST['number_of_groups'])) {
9187
if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) {
9288
Display :: display_error_message(get_lang('PleaseEnterValidNumber').'<br /><br /><a href="group_creation.php?'.api_get_cidreq().'">&laquo; '.get_lang('Back').'</a>', false);
9389
} else {

0 commit comments

Comments
 (0)