Replies: 1 comment 11 replies
-
I found the problem I had with the User creation. I was not correctly representing the Now the create operation seems to work.
The modified parts of the code are: [...]
// Create a new content item for the user details
ContentItem userDetailsContentItem = await _contentManager.NewAsync("UserDetails");
// userDetailsContentItem.Published = true;
// userDetailsContentItem.Latest = true;
// userDetailsContentItem.PublishedUtc = DateTime.UtcNow;
// userDetailsContentItem.ModifiedUtc = DateTime.UtcNow;
// userDetailsContentItem.ContentItemVersionId = Guid.NewGuid().ToString();
// userDetailsContentItem.Weld("UserDetails", new UserDetails());
await userDetailsContentItem.AlterAsync<UserDetails>(async userDetailsPart =>
{
userDetailsPart.Name.Text = userApiModel.UserDetails.Name;
userDetailsPart.Surname.Text = userApiModel.UserDetails.Surname;
userDetailsPart.WhatsApp.Text = userApiModel.UserDetails.WhatsApp;
userDetailsPart.Street.Text = userApiModel.UserDetails.Street;
userDetailsPart.StreetNumber.Text = userApiModel.UserDetails.StreetNumber;
userDetailsPart.City.Text = userApiModel.UserDetails.City;
});
[...] This is how the "UserDetails": {
"DisplayText": " ",
"Name": {
"Text": "A test"
},
"Surname": {
"Text": "Pluto"
},
"Phone": null,
"WhatsApp": {
"Text": "+390123564789"
},
"Street": {
"Text": "Via Marconi"
},
"StreetNumber": {
"Text": "10"
},
"City": {
"Text": "Roma"
},
"ZipCode": {
"Text": "00100"
}
} Questions:
Thank you |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Everyone,
I'm trying to create an
ApiController
to create, read, update, or delete users. This controller will be used in my Orchard Core microservice that will act as an SSO (Single Sign-On) platform. I've already configured theOpenId
module and set up theClient Credentials Flow
to call my new SSO ApiController in a secure way.Now, I took inspiration from this discussion to create a
User
that also has a Content Type calledUserDetails
, which works with the stereotypeCustomUserSettings
and contains extra information. In my ApiController, I want to create this user with the custom settings, and additionally, I want to assign aRole
that already exists in Orchard Core, which I will receive in the payload.I saw that the
UserManager
should be enough to create the user and assign a role, but I want to ensure I'm doing it right.I have created a handler, and the create user API endpoint will call this handler method, you can see it below.
Questions:
EmailConfirmed
to false, will the user automatically receive an email to confirm their email address? Or do I need to create aWorkflow
to verify the user email?Thank you for your help 😊
Beta Was this translation helpful? Give feedback.
All reactions