Fix indentation
This commit is contained in:
@@ -43,13 +43,7 @@ class BoardService {
|
||||
private $l10n;
|
||||
private $permissionService;
|
||||
|
||||
public function __construct(
|
||||
BoardMapper $boardMapper,
|
||||
IL10N $l10n,
|
||||
LabelMapper $labelMapper,
|
||||
AclMapper $aclMapper,
|
||||
PermissionService $permissionService
|
||||
) {
|
||||
public function __construct(BoardMapper $boardMapper, IL10N $l10n, LabelMapper $labelMapper, AclMapper $aclMapper, PermissionService $permissionService) {
|
||||
$this->boardMapper = $boardMapper;
|
||||
$this->labelMapper = $labelMapper;
|
||||
$this->aclMapper = $aclMapper;
|
||||
@@ -81,7 +75,8 @@ class BoardService {
|
||||
'31CC7C' => $this->l10n->t('Finished'),
|
||||
'317CCC' => $this->l10n->t('To review'),
|
||||
'FF7A66' => $this->l10n->t('Action needed'),
|
||||
'F1DB50' => $this->l10n->t('Later')];
|
||||
'F1DB50' => $this->l10n->t('Later')
|
||||
];
|
||||
$labels = [];
|
||||
foreach ($default_labels as $color => $title) {
|
||||
$label = new Label();
|
||||
|
||||
@@ -34,11 +34,7 @@ class CardService {
|
||||
|
||||
private $cardMapper;
|
||||
|
||||
public function __construct(
|
||||
CardMapper $cardMapper,
|
||||
StackMapper $stackMapper,
|
||||
PermissionService $permissionService
|
||||
) {
|
||||
public function __construct(CardMapper $cardMapper, StackMapper $stackMapper, PermissionService $permissionService) {
|
||||
$this->cardMapper = $cardMapper;
|
||||
$this->stackMapper = $stackMapper;
|
||||
$this->permissionService = $permissionService;
|
||||
@@ -48,6 +44,7 @@ class CardService {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ);
|
||||
return $this->cardMapper->find($cardId);
|
||||
}
|
||||
|
||||
public function create($title, $stackId, $type, $order, $owner) {
|
||||
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
|
||||
$card = new Card();
|
||||
@@ -68,7 +65,7 @@ class CardService {
|
||||
public function update($id, $title, $stackId, $type, $order, $description, $owner) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
$card = $this->cardMapper->find($id);
|
||||
if($card->getArchived()) {
|
||||
if ($card->getArchived()) {
|
||||
throw new CardArchivedException();
|
||||
}
|
||||
$card->setTitle($title);
|
||||
@@ -83,30 +80,31 @@ class CardService {
|
||||
public function rename($id, $title) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
$card = $this->cardMapper->find($id);
|
||||
if($card->getArchived()) {
|
||||
if ($card->getArchived()) {
|
||||
throw new CardArchivedException();
|
||||
}
|
||||
$card->setTitle($title);
|
||||
return $this->cardMapper->update($card);
|
||||
}
|
||||
|
||||
public function reorder($id, $stackId, $order) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT);
|
||||
$cards = $this->cardMapper->findAll($stackId);
|
||||
$result = [];
|
||||
$i = 0;
|
||||
foreach ($cards as $card) {
|
||||
if($card->getArchived()) {
|
||||
if ($card->getArchived()) {
|
||||
throw new CardArchivedException();
|
||||
}
|
||||
if($card->id === $id) {
|
||||
if ($card->id === $id) {
|
||||
$card->setOrder($order);
|
||||
$card->setLastModified(time());
|
||||
}
|
||||
|
||||
if($i === $order)
|
||||
if ($i === $order)
|
||||
$i++;
|
||||
|
||||
if($card->id !== $id) {
|
||||
if ($card->id !== $id) {
|
||||
$card->setOrder($i++);
|
||||
}
|
||||
$this->cardMapper->update($card);
|
||||
@@ -133,7 +131,7 @@ class CardService {
|
||||
public function assignLabel($cardId, $labelId) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
||||
$card = $this->cardMapper->find($cardId);
|
||||
if($card->getArchived()) {
|
||||
if ($card->getArchived()) {
|
||||
throw new CardArchivedException();
|
||||
}
|
||||
$this->cardMapper->assignLabel($cardId, $labelId);
|
||||
@@ -142,7 +140,7 @@ class CardService {
|
||||
public function removeLabel($cardId, $labelId) {
|
||||
$this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT);
|
||||
$card = $this->cardMapper->find($cardId);
|
||||
if($card->getArchived()) {
|
||||
if ($card->getArchived()) {
|
||||
throw new CardArchivedException();
|
||||
}
|
||||
$this->cardMapper->removeLabel($cardId, $labelId);
|
||||
|
||||
@@ -32,10 +32,7 @@ class LabelService {
|
||||
|
||||
private $labelMapper;
|
||||
|
||||
public function __construct(
|
||||
LabelMapper $labelMapper,
|
||||
PermissionService $permissionService
|
||||
) {
|
||||
public function __construct(LabelMapper $labelMapper, PermissionService $permissionService) {
|
||||
$this->labelMapper = $labelMapper;
|
||||
$this->permissionService = $permissionService;
|
||||
}
|
||||
|
||||
@@ -43,12 +43,7 @@ class PermissionService {
|
||||
private $logger;
|
||||
private $userId;
|
||||
|
||||
public function __construct(ILogger $logger,
|
||||
AclMapper $aclMapper,
|
||||
BoardMapper $boardMapper,
|
||||
IGroupManager $groupManager,
|
||||
$userId
|
||||
) {
|
||||
public function __construct(ILogger $logger, AclMapper $aclMapper, BoardMapper $boardMapper, IGroupManager $groupManager, $userId) {
|
||||
$this->aclMapper = $aclMapper;
|
||||
$this->boardMapper = $boardMapper;
|
||||
$this->logger = $logger;
|
||||
@@ -84,12 +79,12 @@ class PermissionService {
|
||||
*/
|
||||
public function checkPermission($mapper, $id, $permission) {
|
||||
try {
|
||||
if($mapper instanceof IPermissionMapper) {
|
||||
if ($mapper instanceof IPermissionMapper) {
|
||||
$boardId = $mapper->findBoardId($id);
|
||||
} else {
|
||||
$boardId = $id;
|
||||
}
|
||||
if($boardId === null) {
|
||||
if ($boardId === null) {
|
||||
// Throw NoPermission to not leak information about existing entries
|
||||
throw new NoPermissionException('Permission denied');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user