(id: string, req: string[])
| 208 | } |
| 209 | |
| 210 | private async editCipherCollections(id: string, req: string[]) { |
| 211 | const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); |
| 212 | |
| 213 | const cipher = await this.cipherService.get(id, activeUserId); |
| 214 | if (cipher == null) { |
| 215 | return Response.notFound(); |
| 216 | } |
| 217 | if (cipher.organizationId == null) { |
| 218 | return Response.badRequest( |
| 219 | "Item does not belong to an organization. Consider moving it first.", |
| 220 | ); |
| 221 | } |
| 222 | if (!cipher.viewPassword) { |
| 223 | return Response.noEditPermission(); |
| 224 | } |
| 225 | |
| 226 | cipher.collectionIds = req; |
| 227 | try { |
| 228 | const updatedCipher = await this.cipherService.saveCollectionsWithServer( |
| 229 | cipher, |
| 230 | activeUserId, |
| 231 | ); |
| 232 | const decCipher = await this.cipherService.decrypt(updatedCipher, activeUserId); |
| 233 | const res = new CipherResponse(decCipher); |
| 234 | return Response.success(res); |
| 235 | } catch (e) { |
| 236 | return Response.error(e); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | private async editFolder(id: string, req: FolderExport) { |
| 241 | const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); |
no test coverage detected