| @@ 182-196 (lines=15) @@ | ||
| 179 | * @NoAdminRequired |
|
| 180 | * @NoCSRFRequired |
|
| 181 | */ |
|
| 182 | public function delete($id) { |
|
| 183 | $entity = $this->noteService->find($id); |
|
| 184 | if (!$entity) { |
|
| 185 | return new NotFoundJSONResponse(); |
|
| 186 | } |
|
| 187 | ||
| 188 | if (!$this->shareBackend->checkPermissions(Constants::PERMISSION_DELETE, $entity)) { |
|
| 189 | return new UnauthorizedJSONResponse(); |
|
| 190 | } |
|
| 191 | ||
| 192 | $this->noteService->delete($id); |
|
| 193 | $result = (object)['success' => true]; |
|
| 194 | \OC_Hook::emit('OCA\NextNote', 'post_delete_note', ['note_id' => $id]); |
|
| 195 | return new JSONResponse($result); |
|
| 196 | } |
|
| 197 | ||
| 198 | /** |
|
| 199 | * @param $note array |
|
| @@ 155-169 (lines=15) @@ | ||
| 152 | * @NoAdminRequired |
|
| 153 | * @NoCSRFRequired |
|
| 154 | */ |
|
| 155 | public function delete($id) { |
|
| 156 | $entity = $this->groupService->find($id); |
|
| 157 | if (!$entity) { |
|
| 158 | return new NotFoundJSONResponse(); |
|
| 159 | } |
|
| 160 | ||
| 161 | if (!$this->shareBackend->checkPermissions(Constants::PERMISSION_DELETE, $entity)) { |
|
| 162 | return new UnauthorizedJSONResponse(); |
|
| 163 | } |
|
| 164 | ||
| 165 | $this->groupService->delete($id); |
|
| 166 | $result = (object)['success' => true]; |
|
| 167 | \OC_Hook::emit('OCA\NextNote', 'post_delete_group', ['group_id' => $id]); |
|
| 168 | return new JSONResponse($result); |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * @param $group array |
|