Skip to content

feat: test if specific user can be managed in MagicLinkResource#154

Open
jungm wants to merge 4 commits intop2-inc:mainfrom
jungm:magic-link-fine-grained-authz
Open

feat: test if specific user can be managed in MagicLinkResource#154
jungm wants to merge 4 commits intop2-inc:mainfrom
jungm:magic-link-fine-grained-authz

Conversation

@jungm
Copy link

@jungm jungm commented Nov 14, 2025

See also #145, this makes the REST endpoint respect fine grained authz

@xgp xgp requested a review from rtufisi November 14, 2025 12:40
updateProfile,
updatePassword,
MagicLink.registerEvent(event, MAGIC_LINK));
UserModel user = MagicLink.getOrCreate(session, realm, emailOrUsername, false,
Copy link
Collaborator

@rtufisi rtufisi Dec 16, 2025

Choose a reason for hiding this comment

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

Thank you for doing this change @jungm . It looks good.

Could you please create a separate method for findUser encapsulating the following logic

    // username or email is required, if not provided or empty, exit early and return null
    if (trimToNull(emailOrUsername) == null) {
      return null;
    }
    UserModel user = findUserByNameOrEmail(session, realm, emailOrUsername);
   

We need to refactor the getOrCreate in a near future . It becomes to difficult to use

Copy link
Author

Choose a reason for hiding this comment

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

@rtufisi can you take another quick look? id really appreciate to get this merged so we can just use the upstream of this plugin and don't need to keep our fork

Copy link
Collaborator

@rtufisi rtufisi Feb 23, 2026

Choose a reason for hiding this comment

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

hello @jungm . Apologies for the delay.We added a policy of testing in the new code mergea. We will need this PR to be acompanied by a IT test which will cover the use case you added. Please use the existing functionality as a base example. Thank you!

Copy link
Author

Choose a reason for hiding this comment

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

@rtufisi sorry for the delay on my side as well, added an integration test for my change now

@jungm jungm requested a review from rtufisi January 8, 2026 06:40
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.

2 participants