protected async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); var item = await _dataFactory.ItemRepository.GetItemAsync(Input.Data.SiteId, Input.Data.ModuleId); await _dataFactory.DeleteAsync <DataModelBase>(item); await _dataFactory.SaveChangeAsync(); await _cacheProvider.UpdateCacheAsync(item.SiteId); }
protected override async Task ActionAsync() { if (Input.UserId != Input.Data.UserId) { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); } var userId = Input.Data.UserId; var applicationUser = await _userService.FindApplicationUserByIdAsync(Input.Data.UserId); // TODO validation des données if (!string.IsNullOrEmpty(Input.Data.Email)) { var applicationUserEmail = await _userService.FindApplicationUserByEmailAsync(Input.Data.Email); if (applicationUserEmail != null) { Result.ValidationResult.AddError("EMAIL_ALREADY_EXIST"); return; } if (Input.Data.Email.ToLower() != applicationUser.Email.ToLower()) { applicationUser.Email = Input.Data.Email.ToLower().Trim(); applicationUser.EmailConfirmed = false; var code = await _userManager.GenerateEmailConfirmationTokenAsync(applicationUser); var callbackUrl = "https://www.bworld.fr/Account/ConfirmEmail?userId={0}&code={1}"; var createUserMailModel = new UserChangeMailModel(); createUserMailModel.CallbackUrl = string.Format(callbackUrl, WebUtility.UrlEncode(userId), WebUtility.UrlEncode(code)); createUserMailModel.UserName = applicationUser.FullName; var templateMail = new StringTemplateRenderer().Render(ResourcesLoader.Load(Path.Combine("UserCore", "Renderers", "UserChangeMail.st")), createUserMailModel); await SendEmailAsync(_emailService, applicationUser, "[bworld] Confirmation de votre email", templateMail); } } else { applicationUser.FirstName = Input.Data.FirstName; applicationUser.LastName = Input.Data.LastName; applicationUser.AuthorUrl = Input.Data.AuthorUrl; } await _userService.SaveAsync(applicationUser); }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); var siteUsers = await _siteUserService.FindUsersByUserIdAsync(Input.UserId); foreach (var siteUser in siteUsers) { siteUser.UserId = null; await _siteUserService.SaveAsync(siteUser); } _userService.RemoveAsync(Input.Data); }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); IList <Demo.User.User> users = new List <Demo.User.User>(); var applicationUser = await _userService.GetAllAsync(); foreach (var user in applicationUser) { users.Add(MapUser.Map(user)); } Result.Data = users; }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); if (string.IsNullOrEmpty(Input.Data.ModuleId)) { throw new ArgumentException("L'id du module est null ou vide"); } var item = DataFactoryMongo.MapItemDataModelToItem( await _dataFactory.ItemRepository.GetItemAsync(Input.Data.SiteId, Input.Data.ModuleId)); Result.Data = item; }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); var item = Input.Data; var itemDataModel = await _dataFactory.ItemRepository.GetItemAsync(item.SiteId, item.Id, false, true); MapItemToItemDataModel(item, itemDataModel); await _dataFactory.SaveChangeAsync(); var siteId = item.SiteId; if (string.IsNullOrEmpty(siteId)) { siteId = item.Id; } await _cacheProvider.UpdateCacheAsync(siteId); }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); var siteRepository = _dataFactory.ItemRepository; var siteDataModels = await GetSiteDataModelsAsync(siteRepository); Result.Data = new List <GetSitesResult>(); foreach (var itemDataModel in siteDataModels) { var sitemap = await SiteMap.SitemapUrlAsync(itemDataModel, _dataFactory, _routeManager); Result.Data.Add(new GetSitesResult { SiteId = itemDataModel.Id, Url = sitemap.BaseUrl }); } }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); var siteRepository = _dataFactory.ItemRepository; var siteDataModel = await siteRepository.GetItemAsync(null, Input.Data); var module = _businessModuleFactory.GetModuleCreate(siteDataModel.Module); if (module != null) { await module.DeleteAsync(_dataFactory, _cacheRepository, siteDataModel); } //await Data.DeleteAsync(siteDataModel); await _dataFactory.SaveChangeAsync(); await _userService.RemoveRoleAsync(Input.Data); //await _seoService.ClearAsync(Input.Data); // await _cacheProvider.RemoveCacheAsync(Input.Data); }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); Result.Data = await _logService.GetLogs(Input.Data); }
protected override async Task ActionAsync() { await UserSecurity.CheckIsSuperAdministratorAsync(_userService, Input.UserId); await _logService.ClearLogsAsync(); }