Skip to content
Snippets Groups Projects
Commit 861a2621 authored by Ron Lucke's avatar Ron Lucke Committed by Elmar Ludwig
Browse files

fix #857

parent f276e32b
No related branches found
No related tags found
No related merge requests found
...@@ -30,8 +30,9 @@ class BlocksCopy extends NonJsonApiController ...@@ -30,8 +30,9 @@ class BlocksCopy extends NonJsonApiController
$block = \Courseware\Block::find($data['block']['id']); $block = \Courseware\Block::find($data['block']['id']);
$container = \Courseware\Container::find($data['parent_id']); $container = \Courseware\Container::find($data['parent_id']);
$user = $this->getUser($request);
if (!Authority::canCreateBlocks($user = $this->getUser($request), $container)) { if (!Authority::canCreateBlocks($user, $container) || !Authority::canUpdateBlock($user, $block)) {
throw new AuthorizationFailedException(); throw new AuthorizationFailedException();
} }
...@@ -58,4 +59,4 @@ class BlocksCopy extends NonJsonApiController ...@@ -58,4 +59,4 @@ class BlocksCopy extends NonJsonApiController
//TODO update section block ids //TODO update section block ids
return true; return true;
} }
} }
\ No newline at end of file
...@@ -30,7 +30,8 @@ class ContainersCopy extends NonJsonApiController ...@@ -30,7 +30,8 @@ class ContainersCopy extends NonJsonApiController
$container = \Courseware\Container::find($data['container']['id']); $container = \Courseware\Container::find($data['container']['id']);
$element = \Courseware\StructuralElement::find($data['parent_id']); $element = \Courseware\StructuralElement::find($data['parent_id']);
if (!Authority::canCreateContainer($user = $this->getUser($request), $element)) { $user = $this->getUser($request);
if (!Authority::canCreateContainer($user, $element) || !Authority::canUpdateContainer($user, $container)) {
throw new AuthorizationFailedException(); throw new AuthorizationFailedException();
} }
...@@ -48,4 +49,4 @@ class ContainersCopy extends NonJsonApiController ...@@ -48,4 +49,4 @@ class ContainersCopy extends NonJsonApiController
return $container; return $container;
} }
} }
\ No newline at end of file
...@@ -28,7 +28,8 @@ class StructuralElementsCopy extends NonJsonApiController ...@@ -28,7 +28,8 @@ class StructuralElementsCopy extends NonJsonApiController
$sourceElement = StructuralElement::find($args['id']); $sourceElement = StructuralElement::find($args['id']);
$newParent = StructuralElement::find($data['parent_id']); $newParent = StructuralElement::find($data['parent_id']);
if (!Authority::canCreateContainer($user = $this->getUser($request), $newParent)) { $user = $this->getUser($request);
if (!Authority::canCreateStructuralElement($user, $newParent) || !Authority::canUpdateStructuralElement($user, $sourceElement)) {
throw new AuthorizationFailedException(); throw new AuthorizationFailedException();
} }
......
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