@@ 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 |
@@ 151-165 (lines=15) @@ | ||
148 | * @NoAdminRequired |
|
149 | * @NoCSRFRequired |
|
150 | */ |
|
151 | public function delete($id) { |
|
152 | $entity = $this->groupService->find($id); |
|
153 | if (!$entity) { |
|
154 | return new NotFoundJSONResponse(); |
|
155 | } |
|
156 | ||
157 | if (!$this->shareBackend->checkPermissions(Constants::PERMISSION_DELETE, $entity)) { |
|
158 | return new UnauthorizedJSONResponse(); |
|
159 | } |
|
160 | ||
161 | $this->groupService->delete($id); |
|
162 | $result = (object)['success' => true]; |
|
163 | \OC_Hook::emit('OCA\NextNote', 'post_delete_group', ['group_id' => $id]); |
|
164 | return new JSONResponse($result); |
|
165 | } |
|
166 | } |
|
167 |