Skip to content
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

HP-2530 | Include more information for profile's login methods #532

Merged
merged 7 commits into from
Dec 11, 2024

Conversation

charn
Copy link
Contributor

@charn charn commented Dec 10, 2024

This PR adds additional information fields related to a Profile's login methods (authentication methods in keycloak). Since ProfileNode.loginMethods is already in use, a new ProfileNode.availableLoginMethods field is added and the former is deprecated.

charn added 4 commits December 5, 2024 15:38
When using pre-commit for development it's nice to have
ruff change the files instead of just reporting.

Refs: HP-2530
@charn charn requested a review from a team December 10, 2024 09:43
@charn charn force-pushed the HP-2530-login-methods branch from c61bf30 to 7cb7420 Compare December 10, 2024 09:45
@terovirtanen
Copy link
Contributor

HELSINKI-PROFILE-API branch is deployed to platta: https://helsinki-profile-pr532.api.dev.hel.ninja 🚀🚀🚀

Fixes:
- WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match

Refs: HP-2530
@charn charn force-pushed the HP-2530-login-methods branch 2 times, most recently from bc70c71 to 60defd4 Compare December 10, 2024 11:45
@terovirtanen
Copy link
Contributor

HELSINKI-PROFILE-API branch is deployed to platta: https://helsinki-profile-pr532.api.dev.hel.ninja 🚀🚀🚀

Copy link
Contributor

@danipran danipran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left a couple suggestions 👍

profiles/schema.py Outdated Show resolved Hide resolved
}
}
"""
executed = user_gql_client.execute(
query, auth_token_payload={"amr": amr_claim_value}, service=service
)
assert "errors" not in executed
assert set(executed["data"]["myProfile"]["loginMethods"]) == {
assert executed["data"]["myProfile"]["loginMethods"] == [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the order change here or is it always the same? And if it can change, does the order matter? The reason I originally used set here instead of a list was to ignore the order of the items and just compare the values (because ["foo", "bar"] != ["bar", "foo"])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order should be stable at least in the tests since database doesn't affect the order. Order doesn't matter, so in that sense it could be a set. Though a set could potentially hide a value existing multiple times in the data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the potential duplicates were also a reason why I used sets quite a lot, as you probably noticed. My reasoning back then was that the duplicates wouldn't probably really matter, so I used sets for deduplication.

profiles/schema.py Outdated Show resolved Hide resolved
profiles/schema.py Outdated Show resolved Hide resolved
This extends the information already available from loginMethods
field by adding ceatedAt and userLabel fields to the data. At the
same time loginMethods field is deprecated since this new fields
is meant to replace it.

Refs: HP-2530
@charn charn force-pushed the HP-2530-login-methods branch from 60defd4 to 2679476 Compare December 11, 2024 11:25
@terovirtanen
Copy link
Contributor

HELSINKI-PROFILE-API branch is deployed to platta: https://helsinki-profile-pr532.api.dev.hel.ninja 🚀🚀🚀

@charn charn merged commit 2f04126 into main Dec 11, 2024
21 checks passed
@charn charn deleted the HP-2530-login-methods branch December 11, 2024 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants