Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
@@ -69,10 +69,10 @@ class BoardService {
|
||||
$groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups']);
|
||||
$complete = array_merge($userBoards, $groupBoards);
|
||||
$result = [];
|
||||
foreach($complete as &$item) {
|
||||
if(!array_key_exists($item->getId(), $result)) {
|
||||
foreach ($complete as &$item) {
|
||||
if (!array_key_exists($item->getId(), $result)) {
|
||||
$this->boardMapper->mapOwner($item);
|
||||
if($item->getAcl() !== null) {
|
||||
if ($item->getAcl() !== null) {
|
||||
foreach ($item->getAcl() as &$acl) {
|
||||
$this->boardMapper->mapAcl($acl);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ class BoardService {
|
||||
$board = $this->boardMapper->find($boardId, true, true);
|
||||
$this->boardMapper->mapOwner($board);
|
||||
foreach ($board->getAcl() as &$acl) {
|
||||
if($acl !== null) {
|
||||
if ($acl !== null) {
|
||||
$this->boardMapper->mapAcl($acl);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class BoardService {
|
||||
$this->boardMapper->mapAcl($acl);
|
||||
if ($acl->getType() === Acl::PERMISSION_TYPE_USER) {
|
||||
$assignements = $this->assignedUsersMapper->findByUserId($acl->getParticipant());
|
||||
foreach($assignements as $assignement) {
|
||||
foreach ($assignements as $assignement) {
|
||||
$this->assignedUsersMapper->delete($assignement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,9 +57,12 @@ class CardService {
|
||||
return $card;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $order
|
||||
*/
|
||||
public function create($title, $stackId, $type, $order, $owner) {
|
||||
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->stackMapper, $stackId)) {
|
||||
if ($this->boardService->isArchived($this->stackMapper, $stackId)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = new Card();
|
||||
@@ -74,7 +77,7 @@ class CardService {
|
||||
|
||||
public function delete($id) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
return $this->cardMapper->delete($this->cardMapper->find($id));
|
||||
@@ -82,7 +85,7 @@ class CardService {
|
||||
|
||||
public function update($id, $title, $stackId, $type, $order, $description, $owner, $duedate) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = $this->cardMapper->find($id);
|
||||
@@ -101,7 +104,7 @@ class CardService {
|
||||
|
||||
public function rename($id, $title) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = $this->cardMapper->find($id);
|
||||
@@ -114,7 +117,7 @@ class CardService {
|
||||
|
||||
public function reorder($id, $stackId, $order) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$cards = $this->cardMapper->findAll($stackId);
|
||||
@@ -145,7 +148,7 @@ class CardService {
|
||||
|
||||
public function archive($id) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = $this->cardMapper->find($id);
|
||||
@@ -155,7 +158,7 @@ class CardService {
|
||||
|
||||
public function unarchive($id) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = $this->cardMapper->find($id);
|
||||
@@ -165,7 +168,7 @@ class CardService {
|
||||
|
||||
public function assignLabel($cardId, $labelId) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $cardId)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $cardId)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = $this->cardMapper->find($cardId);
|
||||
@@ -177,7 +180,7 @@ class CardService {
|
||||
|
||||
public function removeLabel($cardId, $labelId) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
||||
if($this->boardService->isArchived($this->cardMapper, $cardId)) {
|
||||
if ($this->boardService->isArchived($this->cardMapper, $cardId)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$card = $this->cardMapper->find($cardId);
|
||||
@@ -194,7 +197,7 @@ class CardService {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$assignment = new AssignedUsers();
|
||||
$assignment = new AssignedUsers();
|
||||
$assignment->setCardId($cardId);
|
||||
$assignment->setParticipant($userId);
|
||||
return $this->assignedUsersMapper->insert($assignment);
|
||||
|
||||
@@ -51,7 +51,7 @@ class LabelService {
|
||||
|
||||
public function create($title, $color, $boardId) {
|
||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
||||
if($this->boardService->isArchived(null, $boardId)) {
|
||||
if ($this->boardService->isArchived(null, $boardId)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$label = new Label();
|
||||
@@ -63,7 +63,7 @@ class LabelService {
|
||||
|
||||
public function delete($id) {
|
||||
$this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE);
|
||||
if($this->boardService->isArchived($this->labelMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->labelMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
return $this->labelMapper->delete($this->find($id));
|
||||
@@ -71,7 +71,7 @@ class LabelService {
|
||||
|
||||
public function update($id, $title, $color) {
|
||||
$this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE);
|
||||
if($this->boardService->isArchived($this->labelMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->labelMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$label = $this->find($id);
|
||||
|
||||
@@ -185,8 +185,8 @@ class PermissionService {
|
||||
*/
|
||||
public function findUsers($boardId) {
|
||||
// cache users of a board so we don't query them for every cards
|
||||
if (array_key_exists((string)$boardId, $this->users)) {
|
||||
return $this->users[(string)$boardId];
|
||||
if (array_key_exists((string) $boardId, $this->users)) {
|
||||
return $this->users[(string) $boardId];
|
||||
}
|
||||
try {
|
||||
$board = $this->boardMapper->find($boardId);
|
||||
@@ -203,14 +203,14 @@ class PermissionService {
|
||||
$user = $this->userManager->get($acl->getParticipant());
|
||||
$users[$user->getUID()] = new User($user);
|
||||
}
|
||||
if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
|
||||
if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) {
|
||||
$group = $this->groupManager->get($acl->getParticipant());
|
||||
foreach ($group->getUsers() as $user) {
|
||||
$users[$user->getUID()] = new User($user);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->users[(string)$boardId] = $users;
|
||||
return $this->users[(string)$boardId];
|
||||
$this->users[(string) $boardId] = $users;
|
||||
return $this->users[(string) $boardId];
|
||||
}
|
||||
}
|
||||
@@ -27,9 +27,7 @@ use OCA\Deck\Db\Acl;
|
||||
use OCA\Deck\Db\CardMapper;
|
||||
use OCA\Deck\Db\LabelMapper;
|
||||
use OCA\Deck\Db\AssignedUsersMapper;
|
||||
|
||||
use OCA\Deck\Db\Stack;
|
||||
|
||||
use OCA\Deck\Db\StackMapper;
|
||||
use OCA\Deck\StatusException;
|
||||
|
||||
@@ -93,9 +91,12 @@ class StackService {
|
||||
return $stacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $order
|
||||
*/
|
||||
public function create($title, $boardId, $order) {
|
||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
||||
if($this->boardService->isArchived(null, $boardId)) {
|
||||
if ($this->boardService->isArchived(null, $boardId)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$stack = new Stack();
|
||||
@@ -113,7 +114,7 @@ class StackService {
|
||||
|
||||
public function update($id, $title, $boardId, $order) {
|
||||
$this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE);
|
||||
if($this->boardService->isArchived($this->stackMapper, $id)) {
|
||||
if ($this->boardService->isArchived($this->stackMapper, $id)) {
|
||||
throw new StatusException('Operation not allowed. This board is archived.');
|
||||
}
|
||||
$stack = $this->stackMapper->find($id);
|
||||
|
||||
Reference in New Issue
Block a user