Skip to content
Snippets Groups Projects
Commit 7fef0df3 authored by Ron Lucke's avatar Ron Lucke Committed by Till Glöggler
Browse files

fix #1144

Closes #1144

Merge request studip/studip!855
parent 9bc8e30f
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ class StructuralElementsCreate extends JsonApiController
'editor_id' => $user->id,
'edit_blocker_id' => '',
'title' => self::arrayGet($json, 'data.attributes.title', ''),
'purpose' => self::arrayGet($json, 'data.attributes.purpose', 'content'),
'purpose' => $parent->purpose,
'payload' => self::arrayGet($json, 'data.attributes.payload', ''),
'position' => $parent->countChildren()
]);
......
......@@ -227,20 +227,23 @@ class StructuralElement extends \SimpleORMap
case 'course':
$hasEditingPermission = $this->hasEditingPermission($user);
if ($this->isTask()) {
// TODO: Was tun wir, wenn dieses Strukturelement purpose=task aber keinen Task hat?
if (!$this->task) {
return false;
$task = $this->task;
if (!$task) {
$task = $this->findParentTask();
if (!$task) {
return false;
}
}
if ($hasEditingPermission) {
return false;
}
if ($this->task->isSubmitted()) {
if ($task->isSubmitted()) {
return false;
}
return $this->task->userIsASolver($user);
return $task->userIsASolver($user);
}
if ($hasEditingPermission) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment