diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2024-07-29 11:17:05 +0200 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2024-07-29 11:17:05 +0200 |
| commit | d50d8c44e1a8185a2fe8af47a3aeb354bc97a105 (patch) | |
| tree | 07bd6c587a5454f621dddd300a66f8d43f5d0f7d /app/controllers | |
| parent | 85e094ea762675a3f3cda83bdedc3ca6b437665e (diff) | |
fixed creating global toolsstep-03348-with-tool
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/lti/tool.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/lti/tool.php b/app/controllers/lti/tool.php index 0d771fc..aa3c072 100644 --- a/app/controllers/lti/tool.php +++ b/app/controllers/lti/tool.php @@ -10,14 +10,14 @@ class Lti_ToolController extends AuthenticatedController $this->deployment = null; $this->tool_id = ''; $this->range_id = ''; + $this->user_may_edit_tool = false; if (in_array($action, ['index', 'add', 'edit', 'delete'])) { $this->range_id = $args[0]; $this->tool_id = $args[1] ?? ''; - if (!$this->range_id || ($this->range_id === 'global' && !$GLOBALS['perm']->have_perm('root'))) { - throw new AccessDeniedException(); - } - if ($this->range_id !== 'global' && !$GLOBALS['perm']->have_studip_perm('tutor', $this->range_id)) { + $this->user_may_edit_tool = ($this->range_id === 'global' && $GLOBALS['perm']->have_perm('root')) + || ($this->range_id !== 'global' && $GLOBALS['perm']->have_studip_perm('tutor', $this->range_id)); + if (!$this->user_may_edit_tool) { throw new AccessDeniedException(); } if ($action === 'add' && !$this->tool_id) { @@ -49,16 +49,16 @@ class Lti_ToolController extends AuthenticatedController public function add_action($range_id, $tool_id = '') { //NOTE: The parameters are checked and processed in the before_filter. - $this->addEditHandler('add'); + $this->addEditHandler(); } public function edit_action($range_id, $tool_id) { //NOTE: The parameters are checked and processed in the before_filter. - $this->addEditHandler('edit'); + $this->addEditHandler(); } - protected function addEditHandler($mode) + protected function addEditHandler() { if (!$this->tool) { return; |
