Skip to content

Commit 508532e

Browse files
committed
nrw-external-api - Add capability to access external libraries
1 parent 43faa5c commit 508532e

5 files changed

Lines changed: 15 additions & 2 deletions

File tree

db/access.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,14 @@
3535
'manager' => CAP_ALLOW,
3636
],
3737
],
38+
// Users with this in the system context can use external question libraries.
39+
'qtype/stack:useexternallibraries' => [
40+
'captype' => 'write',
41+
'contextlevel' => CONTEXT_SYSTEM,
42+
'archetypes' => [
43+
'editingteacher' => CAP_ALLOW,
44+
'manager' => CAP_ALLOW,
45+
],
46+
'clonepermissionsfrom' => 'moodle/question:add',
47+
],
3848
];

lang/en/qtype_stack.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
// Capability names.
5353
$string['stack:usediagnostictools'] = 'Use the STACK tools';
54+
$string['stack:useexternallibraries'] = 'Use external libraries';
5455

5556
// Versions of STACK.
5657
$string['stackversionedited'] = 'This question was authored with STACK version {$a}.';

questionlibrary.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
$cacheid = stack_question_library::STACKLIB;
121121
}
122122
} else if (str_starts_with($location, stack_question_library::GITHUB)) {
123+
require_capability('qtype/stack:useexternallibraries', $thiscontext);
123124
$libparts = explode('/', $location);
124125
$librarytype = $libparts[0];
125126
$libraryid = $libparts[1];
@@ -134,6 +135,7 @@
134135
$externaldetail = $allowedlibraries->{$libraryid}->url;
135136
}
136137
} else if (str_starts_with($location, stack_question_library::NRWSEARCH)) {
138+
require_capability('qtype/stack:useexternallibraries', $thiscontext);
137139
$cacheid = stack_question_library::NRWSEARCH;
138140
$libraryname = null;
139141
$external = stack_question_library::NRWSEARCH;

stack/maxima/stackmaxima.mac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3548,4 +3548,4 @@ is_lang(code):=ev(is(%_STACK_LANG=code),simp=true)$
35483548

35493549
/* Stack expects some output with the version number the output happens at */
35503550
/* maximalocal.mac after additional library loading */
3551-
stackmaximaversion:2026042100$
3551+
stackmaximaversion:2026042700$

version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
defined('MOODLE_INTERNAL') || die();
2626

27-
$plugin->version = 2026042100;
27+
$plugin->version = 2026042700;
2828
$plugin->requires = 2022041900;
2929
$plugin->cron = 0;
3030
$plugin->component = 'qtype_stack';

0 commit comments

Comments
 (0)