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
Add full content serialization mode for GET /@dossier-transfers #7917
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lukasgraf
force-pushed
the
lg/CA-6591/transfer-content
branch
from
March 22, 2024 16:02
3a904a4
to
d940dd8
Compare
lukasgraf
force-pushed
the
lg/CA-6591/transfer-content
branch
6 times, most recently
from
April 11, 2024 13:34
f551efc
to
14a6189
Compare
lukasgraf
force-pushed
the
lg/CA-6591/transfer-content
branch
from
April 26, 2024 13:56
b27f48e
to
f7697ff
Compare
buchi
approved these changes
Apr 29, 2024
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.
👍🏻 LGTM
When validating a dossier transfer token, we now also verify that the token that is being validated matches the token stored on the particular transfer in question. This was sort of validated before as a side effect, because we verified that the transfer ID from the signed claims matched the transfer's ID, but now we also explicitly require the token contents to match. In addition, the TokenManager will now update the persisted token on a transfer when issuing a token for it.
Provide an `is_valid_token` method on the DossierTransfer model instead of a method that may raise an InvalidToken exception. This makes it less clunky to use in later code where we would otherwise have to deal with the exception.
Depending on what flags the python interpreter is launched with, they may not even get checked when running in production.
lukasgraf
force-pushed
the
lg/CA-6591/transfer-content
branch
from
April 29, 2024 09:33
f7697ff
to
8ba1de6
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a "full content serialization" mode to the
GET /@dossier-transfers/<id>
endpoint.The
@perform-dossier-transfer
endpoint will use this (in a server-to-server request) to retrieve all the actual content data when performing a transfer.When invoked with the
?full_content=1
query string parameter, the endpoint also adds serialization of the transfer contents to its response:In this mode,
X-GEVER-Dossier-Transfer-Token
HTTP headercontent
propertyISerializeToJson
serializers, minus some properties that are only of value to the frontend or otherwise uninterestingpath
(parents before children).participations
key as part of the dossier metadata. It contains a list of(participant_id, roles_list)
items where theparticipant_id
matches the ID used as the key in thecontents.contacts
dictionaryExamples:
Overall structure of the additional
content
key:Example of the
participations
key on the dossier serialization:(not to be confused with the top-level
participations
key for the transfer, which is an optional list of selected participations)The participant_id (
person:...
) used in these participations is guaranteed to match the key used in thecontacts
dictionary.Example dossier serialization (click to expand)
Example document serialization (click to expand)
Example contact serialization (click to expand)
For CA-6591
Note
I quickly tested whether these types of serialized represenations can be used to deserialize objects using the
IDeserializeFromJson
deserializers. And it seems to work. Slapping together a class based on the code in opengever/api/add.py I was able to use the serialized JSON output for dossiers and documents to recreate the respective objects, and at least some of the fields were correctly set. Might need quite some tweaking, but in principle the approach seems to work.For CA-6591
Checklist
Changelog entry
Link to issue (Jira or GitHub) and backlink in issue (Jira)
API change:
New functionality:
document
also works formail