-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EC-584] Removed ListResponseModel from OrganizationExportResponseModel #2316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @r-tome
@r-tome We need to add a version check here since the CLI uses this endpoint. The clients sends a |
…-sensitive-in-regards-to-the-server-response-with-ciphers-and-collections
@Hinton thanks for the heads up, that is well spotted! I've included a basic version check on the controller and created the tech debt ticket. |
This now probably also needs to be checked for the |
Correct! I've updated the branch with the new version. |
{ | ||
var userId = _userService.GetProperUserId(User).Value; | ||
|
||
IEnumerable<Collection> orgCollections = await _collectionService.GetOrganizationCollections(organizationId); | ||
(IEnumerable<CipherOrganizationDetails> orgCiphers, Dictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict) = await _cipherService.GetOrganizationCiphers(userId, organizationId); | ||
|
||
var result = new OrganizationExportResponseModel | ||
// Backward compatibility with versions 2022.9.0 and 2022.10.0 that use ListResponseModel | ||
if (new[] { "2022.9.0", "2022.10.0" }.Contains(_currentContext.ClientVersion)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a parser for version and just mark it as _currentContext.ClientVersion.GreaterThan("2022.10.0")
or _currentContext.ClientVersion > ClientVersion(2022, 10, 0)
. But that seems somewhat out of scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or not, we need to include web 9.1 and 9.2 as well, at which point this feels like a pain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change the ICurrentContext.ClientVersion
property to be an instance of the Version
class and this ables us to compare versions.
I'm assuming this fix will go out on version 2022.11.0, is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, depends when QA can test it.
…t use this endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for iterating on this!
{ | ||
var userId = _userService.GetProperUserId(User).Value; | ||
|
||
IEnumerable<Collection> orgCollections = await _collectionService.GetOrganizationCollections(organizationId); | ||
(IEnumerable<CipherOrganizationDetails> orgCiphers, Dictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict) = await _cipherService.GetOrganizationCiphers(userId, organizationId); | ||
|
||
var result = new OrganizationExportResponseModel | ||
// Backward compatibility with versions before 2022.11.0 that use ListResponseModel | ||
if (_currentContext.ClientVersion < new Version("2022.11.0")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to bump this right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed, this will be cherry-picked to rc
and will be on version 2022.11
.
…el (#2316) * [EC-584] Removed ListResponseModel from OrganizationExportResponseModel properties * [EC-584] Added backwards compatibility for client version 2022.9.0 * [EC-584] Added property 'ClientVersion' to ICurrentContext * [EC-584] Added backwards compatibility for version 2022.10.0 * [EC-584] Change ICurrentContext.ClientVersion from string to Version * [EC-584] Remove check for versions before 2022.9.0 because they do not use this endpoint (cherry picked from commit 8a6f780)
Since v2022.9.x the org export uses a different endpoint. But, since v2022.11.x this endpoint will return a different format. See: bitwarden/clients#3641 and bitwarden/server#2316 To support both version in the case of users having an older client either web-vault or cli this PR checks the version and responds using the correct format. If no version can be determined it will use the new format as a default.
Since v2022.9.x the org export uses a different endpoint. But, since v2022.11.x this endpoint will return a different format. See: bitwarden/clients#3641 and bitwarden/server#2316 To support both version in the case of users having an older client either web-vault or cli this PR checks the version and responds using the correct format. If no version can be determined it will use the new format as a default.
…el (#2316) * [EC-584] Removed ListResponseModel from OrganizationExportResponseModel properties * [EC-584] Added backwards compatibility for client version 2022.9.0 * [EC-584] Added property 'ClientVersion' to ICurrentContext * [EC-584] Added backwards compatibility for version 2022.10.0 * [EC-584] Change ICurrentContext.ClientVersion from string to Version * [EC-584] Remove check for versions before 2022.9.0 because they do not use this endpoint (cherry picked from commit 8a6f780)
Type of change
Objective
There is an issue on exporting an organization vault where the nested data from the API response was not being parsed.
These changes revert the behavior back to what it was to previously before the unintended change by removing the wrap with ListResponseModel.
Code changes
Related client changes on this PR.
Before you submit
dotnet format --verify-no-changes
) (required)