-
Notifications
You must be signed in to change notification settings - Fork 3
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
1415: Revoke existing cards via user import endpoint #1674
1415: Revoke existing cards via user import endpoint #1674
Conversation
c6896d1
to
db41432
Compare
f9b6150
to
4fd7777
Compare
Just a general question. Does it make sense to also revoke cards where the DateEnd is in the past. |
as discussed, I will remove that |
I updated base branch, so I can fully test it. |
I think the removal of the end date check is missing. So not sure if its ready for review |
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 tested this and it only partly works as expected:
Use cases:
- If I import non revoked user data, then create a card and activate it in the app, then upload a new csv where the card is revoked, the card is revoked in the app and it is displayed properly to the user
- If I import non revoked user data, then create a pdf, then upload a new csv where the card is revoked and then try to activate the card in the app, with the pdf previously created, i get the error message "Fehler beim lesen des codes", here should be a message: "Your card was revoked"
- it i go to self service (/erstellen) and try to create a card for a revoked user entitlement i get the error "Sie sind scheinbar nicht berechtigt einen KoblenzPass zu erstellen. Bitte prüfen Sie Ihre Eingaben" i think this is missleading, i think the error message should be "You are no longer entitlet for a koblenzpass" or something like thi.
backend/src/main/kotlin/app/ehrenamtskarte/backend/userdata/webservice/UserImportHandler.kt
Outdated
Show resolved
Hide resolved
@ztefanie it's just our current behaviour. if we revoke a card in bayern and the user tries to activate it, he gets the same message. it might be nice to add a separate message for this case, but I think that's a separate task. Upd. created #1692
tbh it doesn't sound like a big difference to me. if a user is no longer entitlet, it also means, he is not entitlet. So, I don't find it measleading. |
Updated:
|
Some thoughts to 3) @seluianova Wir konnten Ihre Angaben nicht im System finden. Bitte überprüfen Sie Ihre Angaben und versuchen Sie es erneut. Due to this upcoming adjustments it will make sense to throw a different error and show a different message to the user as steffi mentioned |
Updated the message when the user entitlement is not found. Will add an additional message once provided. |
9425077
to
775f035
Compare
i think the expiration info will be fetched from another endpoint when the app was started and there should already be an error message. |
@f1sh1918 you mean we should allow card creation when the user entitlement is expired? |
Ah okay i thought the issue is about what to show if an activated card is expired in the app. I think we don't need separate errors but this depends on the error message. I think the user does not have to know if its revoked or the entitlement is expired the important thing is that the entitlement is not valid anymore |
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.
Works great. Tested on ios.
Please address the one issue i mentioned
@@ -145,9 +145,9 @@ class CardMutationService { | |||
) | |||
val userHash = Argon2IdHasher.hashKoblenzUserData(user) | |||
|
|||
val userEntitlements = transaction { UserEntitlementsRepository.findUserEntitlements(userHash.toByteArray()) } | |||
val userEntitlements = transaction { UserEntitlementsRepository.findByUserHash(userHash.toByteArray()) } | |||
if (userEntitlements == null || userEntitlements.revoked || userEntitlements.endDate.isBefore(LocalDate.now())) { |
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 think we have to throw different exceptions here. At least we should create a TODO and ticket if it will not be done here.
We have to distinguish between the input data does not match the entitlement hash then we throw UserEntitlementNotFoundException()
If revoked or expired i would throw
UserEntitlementExpiredException
or sth similar with a separate message
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 will need to associate a new exception with some error message.
Do you think Sie sind nicht mehr berechtigt, einen KoblenzPass zu erstellen
is fine?
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 tested again
184ee6b
to
a0c605a
Compare
Here is the error display for the third variant that @ztefanie mentioned. |
Short description
Revoke cards by entitlementId, when user entitlements are revoked or the expiration date is updated to a past date
Proposed changes
Side effects / open questions
Testing
Full testing is currently blocked, until the app config is ready.
Currently the following can be checked:
curl -H "Authorization: Bearer <my_token>" -F file=@import_testdata_local.csv http://0.0.0.0:8000/users/import
CSV content:
Resolved issues
Fixes: #1415