@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | public function afterException($controller, $methodName, \Exception $exception) { |
62 | 62 | if ($exception instanceof StatusException) { |
63 | - if($this->config->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
63 | + if ($this->config->getSystemValue('loglevel', Util::WARN) === Util::DEBUG) { |
|
64 | 64 | $this->logger->logException($exception); |
65 | 65 | } |
66 | 66 | return new JSONResponse([ |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $groupBoards = $this->boardMapper->findAllByGroups($userInfo['user'], $userInfo['groups']); |
54 | 54 | $complete = array_merge($userBoards, $groupBoards); |
55 | 55 | $result = []; |
56 | - foreach($complete as &$item) { |
|
57 | - if(!array_key_exists($item->getId(), $result)) { |
|
56 | + foreach ($complete as &$item) { |
|
57 | + if (!array_key_exists($item->getId(), $result)) { |
|
58 | 58 | $this->boardMapper->mapOwner($item); |
59 | - if($item->getAcl() !== null) { |
|
59 | + if ($item->getAcl() !== null) { |
|
60 | 60 | foreach ($item->getAcl() as &$acl) { |
61 | 61 | $this->boardMapper->mapAcl($acl); |
62 | 62 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $board = $this->boardMapper->find($boardId, true, true); |
74 | 74 | $this->boardMapper->mapOwner($board); |
75 | 75 | foreach ($board->getAcl() as &$acl) { |
76 | - if($acl !== null) { |
|
76 | + if ($acl !== null) { |
|
77 | 77 | $this->boardMapper->mapAcl($acl); |
78 | 78 | } |
79 | 79 | } |
@@ -64,15 +64,15 @@ |
||
64 | 64 | $acls = $this->aclMapper->findAll($board->getId()); |
65 | 65 | /** @var Acl $acl */ |
66 | 66 | foreach ($acls as $acl) { |
67 | - if($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
67 | + if ($acl->getType() === Acl::PERMISSION_TYPE_USER) { |
|
68 | 68 | $user = $this->userManager->get($acl->getParticipant()); |
69 | - if($user === null) { |
|
69 | + if ($user === null) { |
|
70 | 70 | $this->aclMapper->delete($acl); |
71 | 71 | } |
72 | 72 | } |
73 | - if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
73 | + if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
74 | 74 | $group = $this->groupManager->get($acl->getParticipant()); |
75 | - if($group === null) { |
|
75 | + if ($group === null) { |
|
76 | 76 | $this->aclMapper->delete($acl); |
77 | 77 | } |
78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | public function create($title, $boardId, $order) { |
86 | 86 | $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
87 | - if($this->boardService->isArchived(null, $boardId)) { |
|
87 | + if ($this->boardService->isArchived(null, $boardId)) { |
|
88 | 88 | throw new StatusException('Operation not allowed. This board is archived.'); |
89 | 89 | } |
90 | 90 | $stack = new Stack(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | public function update($id, $title, $boardId, $order) { |
104 | 104 | $this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE); |
105 | - if($this->boardService->isArchived($this->stackMapper, $id)) { |
|
105 | + if ($this->boardService->isArchived($this->stackMapper, $id)) { |
|
106 | 106 | throw new StatusException('Operation not allowed. This board is archived.'); |
107 | 107 | } |
108 | 108 | $stack = $this->stackMapper->find($id); |
@@ -85,6 +85,9 @@ |
||
85 | 85 | return $stacks; |
86 | 86 | } |
87 | 87 | |
88 | + /** |
|
89 | + * @param integer $order |
|
90 | + */ |
|
88 | 91 | public function create($title, $boardId, $order) { |
89 | 92 | $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
90 | 93 | if($this->boardService->isArchived(null, $boardId)) { |
@@ -27,9 +27,7 @@ |
||
27 | 27 | use OCA\Deck\Db\CardMapper; |
28 | 28 | use OCA\Deck\Db\LabelMapper; |
29 | 29 | use OCA\Deck\Db\AssignedUsersMapper; |
30 | - |
|
31 | 30 | use OCA\Deck\Db\Stack; |
32 | - |
|
33 | 31 | use OCA\Deck\Db\StackMapper; |
34 | 32 | use OCA\Deck\StatusException; |
35 | 33 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function create($title, $color, $boardId) { |
53 | 53 | $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
54 | - if($this->boardService->isArchived(null, $boardId)) { |
|
54 | + if ($this->boardService->isArchived(null, $boardId)) { |
|
55 | 55 | throw new StatusException('Operation not allowed. This board is archived.'); |
56 | 56 | } |
57 | 57 | $label = new Label(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | public function delete($id) { |
65 | 65 | $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
66 | - if($this->boardService->isArchived($this->labelMapper, $id)) { |
|
66 | + if ($this->boardService->isArchived($this->labelMapper, $id)) { |
|
67 | 67 | throw new StatusException('Operation not allowed. This board is archived.'); |
68 | 68 | } |
69 | 69 | return $this->labelMapper->delete($this->find($id)); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function update($id, $title, $color) { |
73 | 73 | $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
74 | - if($this->boardService->isArchived($this->labelMapper, $id)) { |
|
74 | + if ($this->boardService->isArchived($this->labelMapper, $id)) { |
|
75 | 75 | throw new StatusException('Operation not allowed. This board is archived.'); |
76 | 76 | } |
77 | 77 | $label = $this->find($id); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | $self = &$this; |
101 | 101 | $notificationManager->registerNotifier(function() use (&$self) { |
102 | 102 | return $self->getContainer()->query(Notifier::class); |
103 | - }, function () { |
|
103 | + }, function() { |
|
104 | 104 | return ['id' => 'deck', 'name' => 'Deck']; |
105 | 105 | }); |
106 | 106 |
@@ -29,7 +29,6 @@ |
||
29 | 29 | use OCP\AppFramework\App; |
30 | 30 | use OCA\Deck\Middleware\SharingMiddleware; |
31 | 31 | use OCP\IGroup; |
32 | - |
|
33 | 32 | use OCP\IUser; |
34 | 33 | use OCP\IUserManager; |
35 | 34 | use OCP\IURLGenerator; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function create($title, $stackId, $type, $order, $owner) { |
61 | 61 | $this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT); |
62 | - if($this->boardService->isArchived($this->stackMapper, $stackId)) { |
|
62 | + if ($this->boardService->isArchived($this->stackMapper, $stackId)) { |
|
63 | 63 | throw new StatusException('Operation not allowed. This board is archived.'); |
64 | 64 | } |
65 | 65 | $card = new Card(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | public function delete($id) { |
76 | 76 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
77 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
77 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
78 | 78 | throw new StatusException('Operation not allowed. This board is archived.'); |
79 | 79 | } |
80 | 80 | return $this->cardMapper->delete($this->cardMapper->find($id)); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public function update($id, $title, $stackId, $type, $order, $description, $owner, $duedate) { |
84 | 84 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
85 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
85 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
86 | 86 | throw new StatusException('Operation not allowed. This board is archived.'); |
87 | 87 | } |
88 | 88 | $card = $this->cardMapper->find($id); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function rename($id, $title) { |
103 | 103 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
104 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
104 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
105 | 105 | throw new StatusException('Operation not allowed. This board is archived.'); |
106 | 106 | } |
107 | 107 | $card = $this->cardMapper->find($id); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | public function reorder($id, $stackId, $order) { |
116 | 116 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
117 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
117 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
118 | 118 | throw new StatusException('Operation not allowed. This board is archived.'); |
119 | 119 | } |
120 | 120 | $cards = $this->cardMapper->findAll($stackId); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | public function archive($id) { |
147 | 147 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
148 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
148 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
149 | 149 | throw new StatusException('Operation not allowed. This board is archived.'); |
150 | 150 | } |
151 | 151 | $card = $this->cardMapper->find($id); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function unarchive($id) { |
157 | 157 | $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
158 | - if($this->boardService->isArchived($this->cardMapper, $id)) { |
|
158 | + if ($this->boardService->isArchived($this->cardMapper, $id)) { |
|
159 | 159 | throw new StatusException('Operation not allowed. This board is archived.'); |
160 | 160 | } |
161 | 161 | $card = $this->cardMapper->find($id); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | public function assignLabel($cardId, $labelId) { |
167 | 167 | $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
168 | - if($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
168 | + if ($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
169 | 169 | throw new StatusException('Operation not allowed. This board is archived.'); |
170 | 170 | } |
171 | 171 | $card = $this->cardMapper->find($cardId); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | public function removeLabel($cardId, $labelId) { |
179 | 179 | $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
180 | - if($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
180 | + if ($this->boardService->isArchived($this->cardMapper, $cardId)) { |
|
181 | 181 | throw new StatusException('Operation not allowed. This board is archived.'); |
182 | 182 | } |
183 | 183 | $card = $this->cardMapper->find($cardId); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | } |
197 | - $assignment = new AssignedUsers(); |
|
197 | + $assignment = new AssignedUsers(); |
|
198 | 198 | $assignment->setCardId($cardId); |
199 | 199 | $assignment->setParticipant($userId); |
200 | 200 | return $this->assignedUsersMapper->insert($assignment); |
@@ -50,6 +50,9 @@ |
||
50 | 50 | return $card; |
51 | 51 | } |
52 | 52 | |
53 | + /** |
|
54 | + * @param integer $order |
|
55 | + */ |
|
53 | 56 | public function create($title, $stackId, $type, $order, $owner) { |
54 | 57 | $this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT); |
55 | 58 | if($this->boardService->isArchived($this->stackMapper, $stackId)) { |
@@ -67,25 +67,25 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function prepare(INotification $notification, $languageCode) { |
69 | 69 | $l = $this->l10nFactory->get('deck', $languageCode); |
70 | - if($notification->getApp() !== 'deck') { |
|
70 | + if ($notification->getApp() !== 'deck') { |
|
71 | 71 | throw new \InvalidArgumentException(); |
72 | 72 | } |
73 | 73 | $notification->setIcon($this->url->getAbsoluteURL($this->url->imagePath('deck', 'deck-dark.svg'))); |
74 | 74 | $params = $notification->getSubjectParameters(); |
75 | 75 | |
76 | - switch($notification->getSubject()) { |
|
76 | + switch ($notification->getSubject()) { |
|
77 | 77 | case 'card-overdue': |
78 | 78 | $cardId = $notification->getObjectId(); |
79 | 79 | $boardId = $this->cardMapper->findBoardId($cardId); |
80 | 80 | $notification->setParsedSubject( |
81 | 81 | (string) $l->t('The card "%s" on "%s" has reached its due date.', $params) |
82 | 82 | ); |
83 | - $notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/'.$boardId.'//card/'.$cardId.''); |
|
83 | + $notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/' . $boardId . '//card/' . $cardId . ''); |
|
84 | 84 | break; |
85 | 85 | case 'board-shared': |
86 | 86 | $boardId = $notification->getObjectId(); |
87 | 87 | $initiator = $this->userManager->get($params[1]); |
88 | - if($initiator !== null) { |
|
88 | + if ($initiator !== null) { |
|
89 | 89 | $dn = $initiator->getDisplayName(); |
90 | 90 | } else { |
91 | 91 | $dn = $params[1]; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ] |
104 | 104 | ] |
105 | 105 | ); |
106 | - $notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/'.$boardId.'/'); |
|
106 | + $notification->setLink($this->url->linkToRouteAbsolute('deck.page.index') . '#!/board/' . $boardId . '/'); |
|
107 | 107 | break; |
108 | 108 | } |
109 | 109 | return $notification; |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function findUsers($boardId) { |
190 | 190 | // cache users of a board so we don't query them for every cards |
191 | - if (array_key_exists((string)$boardId, $this->users)) { |
|
192 | - return $this->users[(string)$boardId]; |
|
191 | + if (array_key_exists((string) $boardId, $this->users)) { |
|
192 | + return $this->users[(string) $boardId]; |
|
193 | 193 | } |
194 | 194 | try { |
195 | 195 | $board = $this->boardMapper->find($boardId); |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | $user = $this->userManager->get($acl->getParticipant()); |
207 | 207 | $users[$user->getUID()] = new User($user); |
208 | 208 | } |
209 | - if($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
209 | + if ($acl->getType() === Acl::PERMISSION_TYPE_GROUP) { |
|
210 | 210 | $group = $this->groupManager->get($acl->getParticipant()); |
211 | 211 | foreach ($group->getUsers() as $user) { |
212 | 212 | $users[$user->getUID()] = new User($user); |
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - $this->users[(string)$boardId] = $users; |
|
217 | - return $this->users[(string)$boardId]; |
|
216 | + $this->users[(string) $boardId] = $users; |
|
217 | + return $this->users[(string) $boardId]; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | \ No newline at end of file |
@@ -89,7 +89,7 @@ |
||
89 | 89 | /** |
90 | 90 | * Get current user permissions for a board |
91 | 91 | * |
92 | - * @param Board|Entity $board |
|
92 | + * @param Board $board |
|
93 | 93 | * @return array|bool |
94 | 94 | * @internal param $boardId |
95 | 95 | */ |