(id: string, req: string[])
| 158 | } |
| 159 | |
| 160 | private async editCipherCollections(id: string, req: string[]) { |
| 161 | const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); |
| 162 | |
| 163 | const cipher = await this.cipherService.get(id, activeUserId); |
| 164 | if (cipher == null) { |
| 165 | return Response.notFound(); |
| 166 | } |
| 167 | if (cipher.organizationId == null) { |
| 168 | return Response.badRequest( |
| 169 | "Item does not belong to an organization. Consider moving it first.", |
| 170 | ); |
| 171 | } |
| 172 | if (!cipher.viewPassword) { |
| 173 | return Response.noEditPermission(); |
| 174 | } |
| 175 | |
| 176 | cipher.collectionIds = req; |
| 177 | try { |
| 178 | const updatedCipher = await this.cipherService.saveCollectionsWithServer( |
| 179 | cipher, |
| 180 | activeUserId, |
| 181 | ); |
| 182 | const decCipher = await this.cipherService.decrypt(updatedCipher, activeUserId); |
| 183 | const res = new CipherResponse(decCipher); |
| 184 | return Response.success(res); |
| 185 | } catch (e) { |
| 186 | return Response.error(e); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | private async editFolder(id: string, req: FolderExport) { |
| 191 | const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); |
no test coverage detected