Check for the card permissions based on attachment id
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -231,8 +231,12 @@ class AttachmentService {
|
|||||||
throw new BadRequestException('attachment id must be a number');
|
throw new BadRequestException('attachment id must be a number');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
try {
|
||||||
$attachment = $this->attachmentMapper->find($attachmentId);
|
$attachment = $this->attachmentMapper->find($attachmentId);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new NoPermissionException('Permission denied');
|
||||||
|
}
|
||||||
|
$this->permissionService->checkPermission($this->cardMapper, $attachment->getCardId(), Acl::PERMISSION_READ);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$service = $this->getService($attachment->getType());
|
$service = $this->getService($attachment->getType());
|
||||||
@@ -266,11 +270,15 @@ class AttachmentService {
|
|||||||
if ($data === false || $data === null) {
|
if ($data === false || $data === null) {
|
||||||
//throw new BadRequestException('data must be provided');
|
//throw new BadRequestException('data must be provided');
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
$attachment = $this->attachmentMapper->find($attachmentId);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new NoPermissionException('Permission denied');
|
||||||
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
$this->permissionService->checkPermission($this->cardMapper, $attachment->getCardId(), Acl::PERMISSION_EDIT);
|
||||||
$this->cache->clear('card-' . $cardId);
|
$this->cache->clear('card-' . $cardId);
|
||||||
|
|
||||||
$attachment = $this->attachmentMapper->find($attachmentId);
|
|
||||||
$attachment->setData($data);
|
$attachment->setData($data);
|
||||||
try {
|
try {
|
||||||
$service = $this->getService($attachment->getType());
|
$service = $this->getService($attachment->getType());
|
||||||
@@ -313,10 +321,15 @@ class AttachmentService {
|
|||||||
throw new BadRequestException('attachment id must be a number');
|
throw new BadRequestException('attachment id must be a number');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
try {
|
||||||
|
$attachment = $this->attachmentMapper->find($attachmentId);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new NoPermissionException('Permission denied');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->permissionService->checkPermission($this->cardMapper, $attachment->getCardId(), Acl::PERMISSION_EDIT);
|
||||||
$this->cache->clear('card-' . $cardId);
|
$this->cache->clear('card-' . $cardId);
|
||||||
|
|
||||||
$attachment = $this->attachmentMapper->find($attachmentId);
|
|
||||||
try {
|
try {
|
||||||
$service = $this->getService($attachment->getType());
|
$service = $this->getService($attachment->getType());
|
||||||
if ($service->allowUndo()) {
|
if ($service->allowUndo()) {
|
||||||
@@ -343,10 +356,15 @@ class AttachmentService {
|
|||||||
throw new BadRequestException('attachment id must be a number');
|
throw new BadRequestException('attachment id must be a number');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
try {
|
||||||
|
$attachment = $this->attachmentMapper->find($attachmentId);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new NoPermissionException('Permission denied');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->permissionService->checkPermission($this->cardMapper, $attachment->getCardId(), Acl::PERMISSION_EDIT);
|
||||||
$this->cache->clear('card-' . $cardId);
|
$this->cache->clear('card-' . $cardId);
|
||||||
|
|
||||||
$attachment = $this->attachmentMapper->find($attachmentId);
|
|
||||||
try {
|
try {
|
||||||
$service = $this->getService($attachment->getType());
|
$service = $this->getService($attachment->getType());
|
||||||
if ($service->allowUndo()) {
|
if ($service->allowUndo()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user