Properly check for the stack AND setting board permissions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -290,10 +290,13 @@ class StackService {
|
||||
throw new BadRequestException('order must be a number');
|
||||
}
|
||||
|
||||
$this->permissionService->checkPermission($this->stackMapper, $boardId, Acl::PERMISSION_MANAGE);
|
||||
if ($this->boardService->isArchived($this->stackMapper, $boardId)) {
|
||||
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_MANAGE);
|
||||
|
||||
if ($this->boardService->isArchived($this->stackMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
|
||||
$stack = $this->stackMapper->find($id);
|
||||
$changes = new ChangeSet($stack);
|
||||
$stack->setTitle($title);
|
||||
|
||||
@@ -195,7 +195,7 @@ class StackServiceTest extends TestCase {
|
||||
}
|
||||
|
||||
public function testUpdate() {
|
||||
$this->permissionService->expects($this->once())->method('checkPermission');
|
||||
$this->permissionService->expects($this->exactly(2))->method('checkPermission');
|
||||
$stack = new Stack();
|
||||
$this->stackMapper->expects($this->once())->method('find')->willReturn($stack);
|
||||
$this->stackMapper->expects($this->once())->method('update')->willReturn($stack);
|
||||
|
||||
Reference in New Issue
Block a user