diff --git a/backend/src/Squidex.Domain.Users/UserManagerExtensions.cs b/backend/src/Squidex.Domain.Users/UserManagerExtensions.cs index a0447a9f6d..daceb64a83 100644 --- a/backend/src/Squidex.Domain.Users/UserManagerExtensions.cs +++ b/backend/src/Squidex.Domain.Users/UserManagerExtensions.cs @@ -100,7 +100,7 @@ void SyncBoolean(string type, bool? value) SyncString(SquidexClaimTypes.DisplayName, values.DisplayName); SyncString(SquidexClaimTypes.PictureUrl, values.PictureUrl); - SyncBoolean(SquidexClaimTypes.Hidden, values.Hidden); + SyncBoolean(SquidexClaimTypes.Hidden, values.IsHidden); SyncBoolean(SquidexClaimTypes.Invited, values.Invited); SyncBoolean(SquidexClaimTypes.Consent, values.Consent); SyncBoolean(SquidexClaimTypes.ConsentForEmails, values.ConsentForEmails); diff --git a/backend/src/Squidex.Domain.Users/UserValues.cs b/backend/src/Squidex.Domain.Users/UserValues.cs index 690cfca27e..a309557a10 100644 --- a/backend/src/Squidex.Domain.Users/UserValues.cs +++ b/backend/src/Squidex.Domain.Users/UserValues.cs @@ -22,7 +22,7 @@ public sealed class UserValues public string Email { get; set; } - public bool? Hidden { get; set; } + public bool? IsHidden { get; set; } public bool? Invited { get; set; } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Users/Models/CreateUserDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Users/Models/CreateUserDto.cs index 4b609b8977..bcdb746c1f 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Users/Models/CreateUserDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Users/Models/CreateUserDto.cs @@ -6,6 +6,7 @@ // ========================================================================== using Squidex.Domain.Users; +using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Security; using Squidex.Infrastructure.Validation; using Squidex.Web; @@ -42,12 +43,6 @@ public sealed class CreateUserDto public UserValues ToValues() { - return new UserValues - { - Email = Email, - DisplayName = DisplayName, - Password = Password, - Permissions = new PermissionSet(Permissions) - }; + return SimpleMapper.Map(this, new UserValues { Permissions = new PermissionSet(Permissions) }); } } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateProfileDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateProfileDto.cs index 5337cabc6e..13155cec87 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateProfileDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateProfileDto.cs @@ -6,6 +6,7 @@ // ========================================================================== using Squidex.Domain.Users; +using Squidex.Infrastructure.Reflection; using Squidex.Web; namespace Squidex.Areas.Api.Controllers.Users.Models; @@ -20,9 +21,6 @@ public sealed class UpdateProfileDto public UserValues ToValues() { - return new UserValues - { - Answers = Answers - }; + return SimpleMapper.Map(this, new UserValues()); } } diff --git a/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateUserDto.cs b/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateUserDto.cs index f133bcb56b..8637135bbc 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateUserDto.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Users/Models/UpdateUserDto.cs @@ -6,6 +6,7 @@ // ========================================================================== using Squidex.Domain.Users; +using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Security; using Squidex.Infrastructure.Validation; using Squidex.Web; @@ -41,12 +42,6 @@ public sealed class UpdateUserDto public UserValues ToValues() { - return new UserValues - { - Email = Email, - DisplayName = DisplayName, - Password = Password, - Permissions = new PermissionSet(Permissions) - }; + return SimpleMapper.Map(this, new UserValues { Permissions = new PermissionSet(Permissions) }; } } diff --git a/backend/src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangeProfileModel.cs b/backend/src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangeProfileModel.cs index 2830cb09ae..ae4dd365ed 100644 --- a/backend/src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangeProfileModel.cs +++ b/backend/src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangeProfileModel.cs @@ -1,4 +1,4 @@ -// ========================================================================== +// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) @@ -6,6 +6,7 @@ // ========================================================================== using Squidex.Domain.Users; +using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Validation; namespace Squidex.Areas.IdentityServer.Controllers.Profile; @@ -22,6 +23,6 @@ public class ChangeProfileModel public UserValues ToValues() { - return new UserValues { Email = Email, DisplayName = DisplayName, Hidden = IsHidden }; + return SimpleMapper.Map(this, new UserValues()); } }