1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05:00

8 Commits

Author SHA1 Message Date
Rui Tomé
abe593d221
[PM-18088] Implement LimitItemDeletion permission checks for all cipher operations (#5476)
* Implement enhanced cipher deletion and restore permissions with feature flag support

- Add new method `CanDeleteOrRestoreCipherAsAdminAsync` in CiphersController
- Update NormalCipherPermissions to support more flexible cipher type checking
- Modify CipherService to use new permission checks with feature flag
- Refactor test methods to support new permission logic
- Improve authorization checks for organization cipher management

* Refactor cipher methods to use CipherDetails and simplify type handling

- Update CiphersController to use GetByIdAsync with userId
- Modify NormalCipherPermissions to remove unnecessary type casting
- Update ICipherService and CipherService method signatures to use CipherDetails
- Remove redundant type checking in CipherService methods
- Improve type consistency in cipher-related operations

* Enhance CiphersControllerTests with detailed permission and feature flag scenarios

- Add test methods for DeleteAdmin with edit and manage permission checks
- Implement tests for LimitItemDeletion feature flag scenarios
- Update test method names to reflect more precise permission conditions
- Improve test coverage for admin cipher deletion with granular permission handling

* Add comprehensive test coverage for admin cipher restore operations

- Implement test methods for PutRestoreAdmin and PutRestoreManyAdmin
- Add scenarios for owner and admin roles with LimitItemDeletion feature flag
- Cover permission checks for manage and edit permissions
- Enhance test coverage for single and bulk cipher restore admin operations
- Verify correct invocation of RestoreAsync and RestoreManyAsync methods

* Refactor CiphersControllerTests to remove redundant assertions and mocking

- Remove unnecessary assertions for null checks
- Simplify mocking setup for cipher repository and service methods
- Clean up redundant type and data setup in test methods
- Improve test method clarity by removing extraneous code

* Add comprehensive test coverage for cipher restore, delete, and soft delete operations

- Implement test methods for RestoreAsync with org admin override and LimitItemDeletion feature flag
- Add scenarios for checking manage and edit permissions during restore operations
- Extend test coverage for DeleteAsync with similar permission and feature flag checks
- Enhance SoftDeleteAsync tests with org admin override and permission validation
- Improve test method names to reflect precise permission conditions

* Add comprehensive test coverage for cipher restore, delete, and soft delete operations

- Extend test methods for RestoreManyAsync with various permission scenarios
- Add test coverage for personal and organization ciphers in restore operations
- Implement tests for RestoreManyAsync with LimitItemDeletion feature flag
- Add detailed test scenarios for delete and soft delete operations
- Improve test method names to reflect precise permission and feature flag conditions

* Refactor authorization checks in CiphersController to use All() method for improved readability

* Refactor filtering of ciphers in CipherService to streamline organization ability checks and improve readability
2025-04-02 10:52:23 +01:00
Nick Krantz
4e1e514e83
[PM-11249] Update cipher revision date when an attachment is added or deleted (#4873)
* update the cipher revision date when an attachment is added or deleted

* store the updated cipher in the DB when an attachment is altered

* return cipher from delete attachment endpoint
2025-01-28 09:49:51 -06:00
Graham Walker
f2182c2aae
PM-16261 fixing linter issue (#5322) 2025-01-24 13:43:41 -06:00
Graham Walker
99a1dbbe02
PM-16261 move ImportCiphersAsync to the tools team (#5245)
* PM-16261 move ImportCiphersAsync to the tools team and create services using CQRS design pattern

* PM-16261 fix renaming methods and add unit tests for succes and bad request exception

* PM-16261 clean up old code from test
2025-01-24 10:57:44 -06:00
Thomas Rittson
0c29e9227c
Remove provider-export-permission feature flag (#5263)
* also remove old CipherService and CollectionService methods
  only used by old export code
2025-01-17 08:28:23 +10:00
Rui Tomé
d94a54516e
[AC-1344] Provider users unable to bulk restore vault items for client organizations (#2871)
* [AC-1344] Added method PutRestoreManyAdmin to CiphersController and refactored PutRestoreMany

* [AC-1344] Fixed unit test

* [AC-1344] Removed comment

* [AC-1344] Fixed sql.csproj

* [AC-1344] Added check for empty or null array; added more unit tests
2023-08-02 16:22:37 +01:00
Federico Maccaroni
10782d55f3
[PM-2682] Fix v0 attachments migration on share cipher with org (#3051)
* PM-2682 Fix v0 attachments migration on share cipher with org

* PM-2682 Fix format

* PM-2682 Fix tests recursion

* Update src/Core/Vault/Models/Data/CipherAttachment.cs

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2023-07-21 16:08:08 -03:00
Robyn MacCallum
3289a8c35e
[SG-998] Move files to Vault folders (#2724)
* Move Api files

* Move Core files

* Move Infrastructure files

* Move Sql Files

* Move Api Sync files to Vault

* Move test vault files

* Update Sql.sqlproj paths

* Update Codeowners

* Fix vault file paths in sqlproj

* Update CipherDetails.sql path in sqlproj

* Update Core models and entities namespaces

* Update namespaces Core Services and Repositories

* Missed service namespaces

* Update Api namespaces

* Update Infrastructure namespaces

* Move infrastructure queries that were missed

* Tests namespace updates

* Admin and Events namespace updates

* Remove unused usings

* Remove extra CiphersController usings

* Rename folder

* Fix CipherDetails namespace

* Sqlproj fixes

* Move stored procs into folders by table

* using order fix
2023-03-02 13:23:38 -05:00