@@ 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 |
@@ 165-179 (lines=15) @@ | ||
162 | * @param $id |
|
163 | * @return NotFoundJSONResponse|UnauthorizedJSONResponse|JSONResponse |
|
164 | */ |
|
165 | public function delete($id) { |
|
166 | $entity = $this->groupService->find($id); |
|
167 | if (!$entity) { |
|
168 | return new NotFoundJSONResponse(); |
|
169 | } |
|
170 | ||
171 | if (!$this->shareBackend->checkPermissions(Constants::PERMISSION_DELETE, $entity)) { |
|
172 | return new UnauthorizedJSONResponse(); |
|
173 | } |
|
174 | ||
175 | $this->groupService->delete($id); |
|
176 | $result = (object)['success' => true]; |
|
177 | \OC_Hook::emit('OCA\NextNote', 'post_delete_group', ['group_id' => $id]); |
|
178 | return new JSONResponse($result); |
|
179 | } |
|
180 | } |
|
181 |