diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentSource.cs b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentSource.cs new file mode 100644 index 00000000000..b20349e2193 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentSource.cs @@ -0,0 +1,58 @@ +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; +using OrchardCore.Deployment; +using OrchardCore.Users.Models; +using OrchardCore.Users.Recipes; +using YesSql; + +namespace OrchardCore.Users.Deployment; + +public class AllUsersDeploymentSource : IDeploymentSource +{ + private readonly ISession _session; + + public AllUsersDeploymentSource(ISession session) + { + _session = session; + } + + public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result) + { + if (step is not AllUsersDeploymentStep allRolesStep) + { + return; + } + + var allUsers = await _session.Query().ListAsync(); + var users = new JArray(); + + foreach (var user in allUsers) + { + users.Add(JObject.FromObject( + new UsersStepUserModel + { + UserName = user.UserName, + UserId = user.UserId, + Id = user.Id, + Email = user.Email, + EmailConfirmed = user.EmailConfirmed, + PasswordHash = user.PasswordHash, + IsEnabled = user.IsEnabled, + NormalizedEmail = user.NormalizedEmail, + NormalizedUserName = user.NormalizedUserName, + SecurityStamp = user.SecurityStamp, + ResetToken = user.ResetToken, + PhoneNumber = user.PhoneNumber, + PhoneNumberConfirmed = user.PhoneNumberConfirmed, + TwoFactorEnabled = user.TwoFactorEnabled, + IsLockoutEnabled = user.IsLockoutEnabled, + AccessFailedCount = user.AccessFailedCount, + RoleNames = user.RoleNames, + })); + } + + result.Steps.Add(new JObject( + new JProperty("name", "Users"), + new JProperty("Users", users))); + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStep.cs b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStep.cs new file mode 100644 index 00000000000..f77a800658a --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStep.cs @@ -0,0 +1,14 @@ +using OrchardCore.Deployment; + +namespace OrchardCore.Users.Deployment; + +/// +/// Adds users to a . +/// +public class AllUsersDeploymentStep : DeploymentStep +{ + public AllUsersDeploymentStep() + { + Name = "AllUsers"; + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStepDriver.cs new file mode 100644 index 00000000000..85d7aee4016 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/AllUsersDeploymentStepDriver.cs @@ -0,0 +1,20 @@ +using OrchardCore.Deployment; +using OrchardCore.DisplayManagement.Handlers; +using OrchardCore.DisplayManagement.Views; + +namespace OrchardCore.Users.Deployment; + +public class AllUsersDeploymentStepDriver : DisplayDriver +{ + public override IDisplayResult Display(AllUsersDeploymentStep step) + { + return Combine( + View("AllUsersDeploymentStep_Summary", step).Location("Summary", "Content"), + View("AllUsersDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content")); + } + + public override IDisplayResult Edit(AllUsersDeploymentStep step) + { + return View("AllUsersDeploymentStep_Edit", step).Location("Content"); + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentSource.cs b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentSource.cs new file mode 100644 index 00000000000..f1ac4aa07a9 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentSource.cs @@ -0,0 +1,57 @@ +using System.Linq; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; +using OrchardCore.Deployment; +using OrchardCore.Users.Models; +using OrchardCore.Users.Services; +using YesSql; + +namespace OrchardCore.Users.Deployment; + +public class CustomUserSettingsDeploymentSource : IDeploymentSource +{ + private readonly CustomUserSettingsService _customUserSettingsService; + private readonly ISession _session; + + public CustomUserSettingsDeploymentSource(CustomUserSettingsService customUserSettingsService, ISession session) + { + _customUserSettingsService = customUserSettingsService; + _session = session; + } + + public async Task ProcessDeploymentStepAsync(DeploymentStep step, DeploymentPlanResult result) + { + var customUserSettingsStep = step as CustomUserSettingsDeploymentStep; + if (customUserSettingsStep == null) + { + return; + } + + var settingsTypes = customUserSettingsStep.IncludeAll + ? _customUserSettingsService.GetAllSettingsTypes().ToList() + : _customUserSettingsService.GetSettingsTypes(customUserSettingsStep.SettingsTypeNames).ToList(); + + // Todo: check permissions for each settings type + var userData = new JArray(); + var allUsers = await _session.Query().ListAsync(); + + foreach (var user in allUsers) + { + var userSettingsData = new JArray(); + foreach (var settingsType in settingsTypes) + { + var userSetting = await _customUserSettingsService.GetSettingsAsync(user, settingsType); + userSettingsData.Add(JObject.FromObject(userSetting)); + } + + userData.Add(new JObject( + new JProperty("userId", user.UserId), + new JProperty("user-custom-user-settings", userSettingsData))); + } + + // Adding custom user settings + result.Steps.Add(new JObject( + new JProperty("name", "custom-user-settings"), + new JProperty("custom-user-settings", userData))); + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentStep.cs b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentStep.cs new file mode 100644 index 00000000000..b77cdfb558a --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentStep.cs @@ -0,0 +1,15 @@ +using OrchardCore.Deployment; + +namespace OrchardCore.Users.Deployment; + +public class CustomUserSettingsDeploymentStep : DeploymentStep +{ + public CustomUserSettingsDeploymentStep() + { + Name = "CustomUserSettings"; + } + + public bool IncludeAll { get; set; } = true; + + public string[] SettingsTypeNames { get; set; } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentStepDriver.cs b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentStepDriver.cs new file mode 100644 index 00000000000..31a532d7931 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Deployment/CustomUserSettingsDeploymentStepDriver.cs @@ -0,0 +1,53 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using OrchardCore.Deployment; +using OrchardCore.DisplayManagement.Handlers; +using OrchardCore.DisplayManagement.ModelBinding; +using OrchardCore.DisplayManagement.Views; +using OrchardCore.Users.Services; +using OrchardCore.Users.ViewModels; + +namespace OrchardCore.Users.Deployment +{ + public class CustomUserSettingsDeploymentStepDriver : DisplayDriver + { + private readonly CustomUserSettingsService _customUserSettingsService; + + public CustomUserSettingsDeploymentStepDriver(CustomUserSettingsService customUserSettingsService) + { + _customUserSettingsService = customUserSettingsService; + } + + public override IDisplayResult Display(CustomUserSettingsDeploymentStep step) + { + return Combine( + View("CustomUserSettingsDeploymentStep_Fields_Summary", step).Location("Summary", "Content"), + View("CustomUserSettingsDeploymentStep_Fields_Thumbnail", step).Location("Thumbnail", "Content")); + } + + public override IDisplayResult Edit(CustomUserSettingsDeploymentStep step) + { + return Initialize("CustomUserSettingsDeploymentStep_Fields_Edit", model => + { + model.IncludeAll = step.IncludeAll; + model.SettingsTypeNames = step.SettingsTypeNames; + model.AllSettingsTypeNames = _customUserSettingsService.GetAllSettingsTypeNames().ToArray(); + }) + .Location("Content"); + } + + public override async Task UpdateAsync(CustomUserSettingsDeploymentStep step, IUpdateModel updater) + { + step.SettingsTypeNames = Array.Empty(); + await updater.TryUpdateModelAsync(step, Prefix); + + if (step.IncludeAll) + { + step.SettingsTypeNames = Array.Empty(); + } + + return Edit(step); + } + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Models/UsersStepModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/Models/UsersStepModel.cs new file mode 100644 index 00000000000..8089aa25b42 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Models/UsersStepModel.cs @@ -0,0 +1,6 @@ +namespace OrchardCore.Users.Models; + +public class UsersStepModel +{ + public UsersStepUserModel[] Users { get; set; } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Models/UsersStepUserModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/Models/UsersStepUserModel.cs new file mode 100644 index 00000000000..5b38e5be2bc --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Models/UsersStepUserModel.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace OrchardCore.Users.Models; + +public class UsersStepUserModel +{ + public long Id { get; set; } + + public string UserId { get; set; } + + public string UserName { get; set; } + + public string Email { get; set; } + + public string PasswordHash { get; set; } + + public bool EmailConfirmed { get; set; } + + public bool IsEnabled { get; set; } = true; + + public string NormalizedEmail { get; set; } + + public string NormalizedUserName { get; set; } + + public string SecurityStamp { get; set; } + + public string ResetToken { get; set; } + public string PhoneNumber { get; set; } + + public bool PhoneNumberConfirmed { get; set; } + + public bool TwoFactorEnabled { get; set; } + + public bool IsLockoutEnabled { get; set; } + + public int AccessFailedCount { get; set; } + + public IList RoleNames { get; set; } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Recipes/CustomUserSettingsStep.cs b/src/OrchardCore.Modules/OrchardCore.Users/Recipes/CustomUserSettingsStep.cs new file mode 100644 index 00000000000..58e73950933 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Recipes/CustomUserSettingsStep.cs @@ -0,0 +1,70 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; +using OrchardCore.ContentManagement; +using OrchardCore.Recipes.Models; +using OrchardCore.Recipes.Services; +using OrchardCore.Users.Models; +using YesSql; + +namespace OrchardCore.Users.Recipes; + +/// +/// This recipe step updates the custom user settings. +/// +public class CustomUserSettingsStep : IRecipeStepHandler +{ + private readonly ISession _session; + + public CustomUserSettingsStep(ISession session) + { + _session = session; + } + + public async Task ExecuteAsync(RecipeExecutionContext context) + { + if (!string.Equals(context.Name, "custom-user-settings", StringComparison.OrdinalIgnoreCase)) + { + return; + } + + var model = context.Step; + + var customUserSettingsList = (JArray)model + .Properties() + .Where(p => p.Name != "name") + .FirstOrDefault() + ?.Value; + + var allUsers = await _session.Query().ListAsync(); + + foreach (JObject userCustomUserSettings in customUserSettingsList.Cast()) + { + var userId = userCustomUserSettings + .Properties() + .FirstOrDefault(p => p.Name == "userId")? + .Value + ?.ToString(); + + var user = allUsers.FirstOrDefault(u => u.UserId == userId); + if (user is not User _) + { + continue; + } + + var userSettings = (JArray)userCustomUserSettings + .Properties() + .FirstOrDefault(p => p.Name == "user-custom-user-settings") + ?.Value; + + foreach (JObject userSetting in userSettings.Cast()) + { + var contentItem = userSetting.ToObject(); + user.Properties[contentItem.ContentType] = userSetting; + } + + _session.Save(user); + } + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Recipes/UsersStep.cs b/src/OrchardCore.Modules/OrchardCore.Users/Recipes/UsersStep.cs new file mode 100644 index 00000000000..64763e6c886 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Recipes/UsersStep.cs @@ -0,0 +1,66 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity; +using OrchardCore.Recipes.Models; +using OrchardCore.Recipes.Services; +using OrchardCore.Users.Models; +using YesSql; + +namespace OrchardCore.Users.Recipes; + +public class UsersStep : IRecipeStepHandler +{ + private readonly UserManager _userManager; + private readonly ISession _session; + + public UsersStep( + UserManager userManager, + ISession session) + { + _userManager = userManager; + _session = session; + } + + public async Task ExecuteAsync(RecipeExecutionContext context) + { + if (!string.Equals(context.Name, "Users", StringComparison.OrdinalIgnoreCase)) + { + return; + } + + var model = context.Step.ToObject(); + + foreach (var importedUser in model.Users) + { + if (string.IsNullOrWhiteSpace(importedUser.UserName)) + { + continue; + } + + var iUser = await _userManager.FindByIdAsync(importedUser.UserId); + + if (iUser is not User user) + { + user = new User { UserId = importedUser.UserId }; + } + + user.Email = importedUser.Email; + user.UserName = importedUser.UserName; + user.EmailConfirmed = importedUser.EmailConfirmed; + user.PasswordHash = importedUser.PasswordHash; + user.IsEnabled = importedUser.IsEnabled; + user.NormalizedEmail = importedUser.NormalizedEmail; + user.NormalizedUserName = importedUser.NormalizedUserName; + user.SecurityStamp = importedUser.SecurityStamp; + user.ResetToken = importedUser.ResetToken; + user.AccessFailedCount = importedUser.AccessFailedCount; + user.IsLockoutEnabled = importedUser.IsLockoutEnabled; + user.TwoFactorEnabled = importedUser.TwoFactorEnabled; + user.PhoneNumber = importedUser.PhoneNumber; + user.PhoneNumberConfirmed = importedUser.PhoneNumberConfirmed; + user.RoleNames = importedUser.RoleNames; + + _session.Save(user); + } + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Services/CustomUserSettingsService.cs b/src/OrchardCore.Modules/OrchardCore.Users/Services/CustomUserSettingsService.cs new file mode 100644 index 00000000000..f4b923f946b --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Services/CustomUserSettingsService.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Newtonsoft.Json.Linq; +using OrchardCore.ContentManagement; +using OrchardCore.ContentManagement.Metadata; +using OrchardCore.ContentManagement.Metadata.Models; +using OrchardCore.Users.Models; +using YesSql; + +namespace OrchardCore.Users.Services; + +public class CustomUserSettingsService +{ + private readonly IContentManager _contentManager; + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly IAuthorizationService _authorizationService; + private readonly IContentDefinitionManager _contentDefinitionManager; + private readonly Lazy> _settingsTypes; + private readonly YesSql.ISession _session; + + public CustomUserSettingsService( + IContentManager contentManager, + IHttpContextAccessor httpContextAccessor, + IAuthorizationService authorizationService, + IContentDefinitionManager contentDefinitionManager, + YesSql.ISession session) + { + _contentManager = contentManager; + _httpContextAccessor = httpContextAccessor; + _authorizationService = authorizationService; + _contentDefinitionManager = contentDefinitionManager; + _settingsTypes = new Lazy>( + () => _contentDefinitionManager + .ListTypeDefinitions() + .Where(x => x.StereotypeEquals("CustomUserSettings")) + .ToDictionary(x => x.Name)); + + _session = session; + } + + public IEnumerable GetAllSettingsTypeNames() => _settingsTypes.Value.Keys; + + public IEnumerable GetAllSettingsTypes() + { + return _settingsTypes.Value.Values; + } + + public IEnumerable GetSettingsTypes(params string[] settingsTypeNames) + { + foreach (var settingsTypeName in settingsTypeNames) + { + if (_settingsTypes.Value.TryGetValue(settingsTypeName, out ContentTypeDefinition settingsType)) + { + yield return settingsType; + } + } + } + + public ContentTypeDefinition GetSettingsType(string settingsTypeName) + { + _settingsTypes.Value.TryGetValue(settingsTypeName, out ContentTypeDefinition settingsType); + return settingsType; + } + + public Task> GetSettingsAsync(string settingsTypeName, Func factoryAsync = null) + { + var settingsType = GetSettingsType(settingsTypeName); + if (settingsType == null) + { + return Task.FromResult>(null); + } + + return GetSettingsAsync(settingsType, factoryAsync); + } + + public async Task> GetSettingsAsync(ContentTypeDefinition settingsType, Func factoryAsync = null) + { + var users = await _session.Query().ListAsync(); + var contentItems = new Dictionary(); + foreach (var user in users) + { + var item = await GetSettingsAsync(user, settingsType, factoryAsync); + if (item != null) + { + contentItems.Add(user.UserId, item); + } + } + + return contentItems; + } + + public async Task GetSettingsAsync(User user, ContentTypeDefinition settingsType, Func factoryAsync = null) + { + ContentItem contentItem; + + if (user.Properties.TryGetValue(settingsType.Name, out JToken property)) + { + var existing = property.ToObject(); + + // Create a new item to take into account the current type definition. + contentItem = await _contentManager.NewAsync(existing.ContentType); + contentItem.Merge(existing); + + return contentItem; + } + + contentItem = await _contentManager.NewAsync(settingsType.Name); + await factoryAsync?.Invoke(); + + return contentItem; + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs index 01c3a4cd9df..f538777369c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/Startup.cs @@ -18,6 +18,7 @@ using OrchardCore.Data; using OrchardCore.Data.Migration; using OrchardCore.DisplayManagement.Descriptors; +using OrchardCore.Deployment; using OrchardCore.DisplayManagement.Handlers; using OrchardCore.DisplayManagement.Theming; using OrchardCore.Environment.Commands; @@ -28,6 +29,7 @@ using OrchardCore.Modules; using OrchardCore.Mvc.Core.Utilities; using OrchardCore.Navigation; +using OrchardCore.Recipes; using OrchardCore.Recipes.Services; using OrchardCore.ResourceManagement; using OrchardCore.Security; @@ -38,11 +40,13 @@ using OrchardCore.Sms; using OrchardCore.Users.Commands; using OrchardCore.Users.Controllers; +using OrchardCore.Users.Deployment; using OrchardCore.Users.Drivers; using OrchardCore.Users.Handlers; using OrchardCore.Users.Indexes; using OrchardCore.Users.Liquid; using OrchardCore.Users.Models; +using OrchardCore.Users.Recipes; using OrchardCore.Users.Services; using OrchardCore.Users.ViewModels; using YesSql.Filters.Query; @@ -249,6 +253,11 @@ public override void ConfigureServices(IServiceCollection services) services.AddScoped, UserMenuNavbarDisplayDriver>(); services.AddScoped, UserMenuDisplayDriver>(); services.AddScoped(); + + services.AddRecipeExecutionStep(); + + services.AddScoped(); + services.AddRecipeExecutionStep(); } } @@ -496,6 +505,20 @@ public override void ConfigureServices(IServiceCollection services) { services.AddScoped, CustomUserSettingsDisplayDriver>(); services.AddScoped(); + + services.AddTransient(); + services.AddSingleton>(); + services.AddScoped, CustomUserSettingsDeploymentStepDriver>(); + } + } + + public class UserDeploymentStartup : StartupBase + { + public override void ConfigureServices(IServiceCollection services) + { + services.AddTransient(); + services.AddSingleton>(); + services.AddScoped, AllUsersDeploymentStepDriver>(); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/CustomUserSettingsDeploymentStepViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/CustomUserSettingsDeploymentStepViewModel.cs new file mode 100644 index 00000000000..6f77a0449fe --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/CustomUserSettingsDeploymentStepViewModel.cs @@ -0,0 +1,10 @@ +namespace OrchardCore.Users.ViewModels; + +public class CustomUserSettingsDeploymentStepViewModel +{ + public bool IncludeAll { get; set; } + + public string[] SettingsTypeNames { get; set; } + + public string[] AllSettingsTypeNames { get; set; } +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/CustomUserSettingsEditViewModel.cs b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/CustomUserSettingsEditViewModel.cs index e5d6110c732..8abde3f17f1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/CustomUserSettingsEditViewModel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/ViewModels/CustomUserSettingsEditViewModel.cs @@ -1,7 +1,6 @@ -namespace OrchardCore.Users.ViewModels +namespace OrchardCore.Users.ViewModels; + +public class CustomUserSettingsEditViewModel { - public class CustomUserSettingsEditViewModel - { - public dynamic Editor { get; set; } - } + public dynamic Editor { get; set; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Edit.cshtml new file mode 100644 index 00000000000..e5ca5f0ad6f --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Edit.cshtml @@ -0,0 +1 @@ +
@T["All Users"]
diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Summary.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Summary.cshtml new file mode 100644 index 00000000000..20554274efc --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Summary.cshtml @@ -0,0 +1,3 @@ +
@T["All Users"]
+ +@T["Adds all users to the plan."] diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Thumbnail.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Thumbnail.cshtml new file mode 100644 index 00000000000..93e48763505 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/AllUsersDeploymentStep.Thumbnail.cshtml @@ -0,0 +1,2 @@ +

@T["All Users"]

+

@T["Exports every user."]

diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Edit.cshtml new file mode 100644 index 00000000000..814e0d60606 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Edit.cshtml @@ -0,0 +1,44 @@ +@model CustomUserSettingsDeploymentStepViewModel + +
@T["Custom User Settings"]
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ @T["The custom user settings to add as part of the plan."] +
+
+
+
+
    + @foreach (var settingsTypeName in Model.AllSettingsTypeNames) + { + var checkd = Model.SettingsTypeNames?.Contains(settingsTypeName); + +
  • +
    + +
    +
  • + } +
+
+
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Summary.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Summary.cshtml new file mode 100644 index 00000000000..d9a46e4aa04 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Summary.cshtml @@ -0,0 +1,24 @@ +@model ShapeViewModel + +@{ + var includeAll = Model.Value.IncludeAll; + var settingsTypeNames = Model.Value.SettingsTypeNames; +} + +
@T["Custom User Settings"]
+ +@if (includeAll) +{ + @T["All"] +} +else if (settingsTypeNames?.Length > 0) +{ + foreach (var settingsTypeName in settingsTypeNames) + { + @settingsTypeName + } +} +else +{ + @T["No custom user settings selected."] +} diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Thumbnail.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Thumbnail.cshtml new file mode 100644 index 00000000000..464e1434a7b --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/Items/CustomUserSettingsDeploymentStep.Fields.Thumbnail.cshtml @@ -0,0 +1,2 @@ +

@T["Custom User Settings"]

+

@T["Exports all or specified custom user settings."]

diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/_ViewImports.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/_ViewImports.cshtml index d03012077cb..904487cf470 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Views/_ViewImports.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/_ViewImports.cshtml @@ -19,3 +19,4 @@ @using OrchardCore.Users.TimeZone @using OrchardCore.Users.TimeZone.ViewModels @using OrchardCore.Workflows.Helpers +@using OrchardCore.Users.Deployment