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

Make IExternalLoginEventHandler support update User‘s properties #12845

Merged
merged 96 commits into from
May 29, 2024

Conversation

hyzx86
Copy link
Contributor

@hyzx86 hyzx86 commented Nov 20, 2022

Summary of this PR
relate #6263
Enable the login script to generate user properties other than Roles,We can use the login script update user.properties , just like all of CustomUserSettings

  • External Login Script now support update UserClaims and user's Properties
  • Update description use monaco-editor
  • Change the editor to monaco-editor
  • Add code suggestion to editor

@hyzx86 hyzx86 changed the title Change IExternalLoginEventHandler UpdateRoles to UpdateUser Make IExternalLoginEventHandler support update User‘s properties Nov 20, 2022
@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 20, 2022

external login script
image

database
image

@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 22, 2022

Perhaps ClaimsToUpdate should also be added?

@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 27, 2022

@Skrypt @hishamco Can you help to review?

@hishamco
Copy link
Member

@hyzx86 you could request a review from the reviewers section instead of ping in the comment. I think you already did in another PR ;)

@hishamco
Copy link
Member

BTW some of the sugession might require a discussion before submitting a PR

@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 27, 2022

BTW some of the sugession might require a discussion before submitting a PR

Yes ,here.

#7671

@hyzx86
Copy link
Contributor Author

hyzx86 commented Nov 27, 2022

@hyzx86 you could request a review from the reviewers section instead of ping in the comment. I think you already did in another PR ;)

Are you talking about this ?

image

@sebastienros
Copy link
Member

I like the idea of using the existing script but I am not a fan of the way it's done with merging an object. I would prefer an api like the current roles one

context.setUserProperty("FirtName", "Han");

// or

context.userProperties["FirtName"] = "Han";
context.userProperties.firstName = "Han";

@sebastienros sebastienros added this to the 1.x milestone Dec 1, 2022
@hyzx86
Copy link
Contributor Author

hyzx86 commented Dec 2, 2022

@sebastienros

But if the attribute path is deep

the script will be like this?

context.setUserProperty("UserProfileInternal.UserProfilePart.FirtName.Text", "Han");

Then build the Json object with comma separation to update the existing user properties
This will lead to more checks, and it is impossible to avoid users directly assigning complex objects to an attribute

I like the idea of using the existing script but I am not a fan of the way it's done with merging an object. I would prefer an api like the current roles one

Will there be any problems if use merge?

@sebastienros
Copy link
Member

sebastienros commented Dec 2, 2022

Makes sense. Could it be "rooted" of the part though, like

{
  firstName: {
    text: "Han"
  }
}

@hyzx86
Copy link
Contributor Author

hyzx86 commented Dec 5, 2022

Makes sense. Could it be "rooted" of the part though, like

My idea is to be compatible with CustomUserSettings
It does not only support specific types or properties defined in C # code, such as UserTimeZone
This design can well support any CustomUserSettings type definition

In addition, I want to add UserClaims to this function
It should be very useful when using third-party oidc authorization

@hyzx86
Copy link
Contributor Author

hyzx86 commented Jan 9, 2023

@sebastienros this PR is ready to merge

@gvkries
Copy link
Contributor

gvkries commented Dec 5, 2023

What is this one holding back? It would be super useful 😊

@hishamco
Copy link
Member

hishamco commented Dec 6, 2023

@hyzx86 please fix the conflict

@hyzx86
Copy link
Contributor Author

hyzx86 commented Dec 6, 2023

@hishamco Done

@hishamco
Copy link
Member

hishamco commented Dec 6, 2023

We might need to triage this one

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@hishamco
Copy link
Member

Could you please fix the conflict?

@Piedone
Copy link
Member

Piedone commented Mar 14, 2024

@hishamco please bring this up on the triage meeting. The PR has been in limbo for too long.

@hyzx86
Copy link
Contributor Author

hyzx86 commented Mar 14, 2024

Could you please fix the conflict?

It's updated so fast... I've fix the conflict many times 🤣, so let's talk about whether this PR is possible first, to save everyone some time

@Piedone
Copy link
Member

Piedone commented May 27, 2024

I'm OK with it if you're OK.

@hishamco
Copy link
Member

@hyzx86 please react to the latest changes then I can merge, I know if you wait a merge conflict will show up :)

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@hyzx86
Copy link
Contributor Author

hyzx86 commented May 28, 2024

@hyzx86 please react to the latest changes then I can merge, I know if you wait a merge conflict will show up :)

Done , It's finally going to be merged into the main branch. I'm looking forward to it. 🎉🎉🎉🎉🎉🎉

@hyzx86 hyzx86 requested a review from hishamco May 28, 2024 17:38
@hyzx86 hyzx86 requested a review from hishamco May 29, 2024 02:47
@hishamco hishamco merged commit 08e5f6e into OrchardCMS:main May 29, 2024
11 checks passed
@hishamco
Copy link
Member

@hyzx86 finally it has been merged :) thanks for your patient and contribution

@hyzx86 hyzx86 deleted the UpdateExternalUser branch May 30, 2024 02:35
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.

5 participants