draft: refactor project so it sits on top of a standalone app
This commit is contained in:
@@ -1,15 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Extensions;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Mapper;
|
||||
using zero.Web.Mapper;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -17,15 +10,11 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Settings.Applications, PermissionsValue.Read)]
|
||||
public class ApplicationsController : BackofficeController
|
||||
{
|
||||
private IApplicationsApi Api { get; set; }
|
||||
IApplicationsApi Api;
|
||||
|
||||
private ZeroOptions Options { get; set; }
|
||||
|
||||
|
||||
public ApplicationsController(IZeroConfiguration config, IApplicationsApi api, IMapper mapper, IToken token, IOptionsMonitor<ZeroOptions> options) : base(config, mapper, token)
|
||||
public ApplicationsController(IApplicationsApi api)
|
||||
{
|
||||
Api = api;
|
||||
Options = options.CurrentValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +55,7 @@ namespace zero.Web.Controllers
|
||||
/// </summary>
|
||||
public IActionResult GetAllFeatures()
|
||||
{
|
||||
return Json(Options.Features);
|
||||
return Json(Options.Backoffice.Features);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Identity;
|
||||
@@ -11,9 +10,9 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(false)]
|
||||
public class AuthenticationController : BackofficeController
|
||||
{
|
||||
private IAuthenticationApi Api { get; set; }
|
||||
IAuthenticationApi Api;
|
||||
|
||||
public AuthenticationController(IZeroConfiguration config, IAuthenticationApi api) : base(config)
|
||||
public AuthenticationController(IAuthenticationApi api)
|
||||
{
|
||||
Api = api;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
@@ -15,30 +16,33 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize, CanEdit, AddToken]
|
||||
public abstract class BackofficeController : Controller
|
||||
{
|
||||
protected IZeroConfiguration Configuration { get; set; }
|
||||
IMapper _mapper;
|
||||
|
||||
protected IMapper Mapper { get; set; }
|
||||
IZeroOptions _options;
|
||||
|
||||
protected IToken Token { get; set; }
|
||||
|
||||
|
||||
public BackofficeController(IZeroConfiguration config, IMapper mapper, IToken token)
|
||||
protected IMapper Mapper
|
||||
{
|
||||
Configuration = config;
|
||||
Mapper = mapper;
|
||||
Token = token;
|
||||
get
|
||||
{
|
||||
return _mapper ?? (_mapper = HttpContext?.RequestServices?.GetService<IMapper>());
|
||||
}
|
||||
}
|
||||
|
||||
protected IZeroOptions Options
|
||||
{
|
||||
get
|
||||
{
|
||||
return _options ?? (_options = HttpContext?.RequestServices?.GetService<IZeroOptions>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public BackofficeController(IZeroConfiguration config)
|
||||
public BackofficeController()
|
||||
{
|
||||
Configuration = config;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//protected
|
||||
|
||||
|
||||
protected async Task<IActionResult> As<T, TTarget>(T model) where TTarget : class, new() where T : IZeroEntity
|
||||
{
|
||||
if (model == null)
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Mapper;
|
||||
using zero.Web.Mapper;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -13,9 +10,9 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Settings.Countries, PermissionsValue.Read)]
|
||||
public class CountriesController : BackofficeController
|
||||
{
|
||||
private ICountriesApi Api { get; set; }
|
||||
ICountriesApi Api;
|
||||
|
||||
public CountriesController(IZeroConfiguration config, ICountriesApi api, IMapper mapper, IToken token) : base(config, mapper, token)
|
||||
public CountriesController(ICountriesApi api)
|
||||
{
|
||||
Api = api;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using zero.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using zero.Core.Extensions;
|
||||
using zero.Core.Identity;
|
||||
using zero.Web.Models;
|
||||
@@ -11,11 +8,9 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(false)]
|
||||
public class IndexController : BackofficeController
|
||||
{
|
||||
private ZeroOptions Options { get; set; }
|
||||
|
||||
private IZeroVue ZeroVue { get; set; }
|
||||
|
||||
public IndexController(IZeroConfiguration config, IZeroVue zeroVue) : base(config)
|
||||
public IndexController(IZeroVue zeroVue)
|
||||
{
|
||||
ZeroVue = zeroVue;
|
||||
}
|
||||
@@ -23,7 +18,7 @@ namespace zero.Web.Controllers
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (Configuration.ZeroVersion.IsNullOrEmpty())
|
||||
if (Options.ZeroVersion.IsNullOrEmpty())
|
||||
{
|
||||
return RedirectToAction("Index", "Setup");
|
||||
}
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Extensions;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Mapper;
|
||||
using zero.Web.Mapper;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -17,15 +10,12 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Settings.Languages, PermissionsValue.Read)]
|
||||
public class LanguagesController : BackofficeController
|
||||
{
|
||||
private ILanguagesApi Api { get; set; }
|
||||
|
||||
private ZeroOptions Options { get; set; }
|
||||
ILanguagesApi Api;
|
||||
|
||||
|
||||
public LanguagesController(IZeroConfiguration config, ILanguagesApi api, IMapper mapper, IToken token, IOptionsMonitor<ZeroOptions> options) : base(config, mapper, token)
|
||||
public LanguagesController(ILanguagesApi api)
|
||||
{
|
||||
Api = api;
|
||||
Options = options.CurrentValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
{
|
||||
public class PageTreeController : BackofficeController
|
||||
{
|
||||
private IPageTreeApi Api { get; set; }
|
||||
IPageTreeApi Api;
|
||||
IWebHostEnvironment Env;
|
||||
|
||||
private IWebHostEnvironment Env { get; set; }
|
||||
|
||||
public PageTreeController(IZeroConfiguration config, IPageTreeApi api, IWebHostEnvironment env) : base(config)
|
||||
public PageTreeController(IPageTreeApi api, IWebHostEnvironment env)
|
||||
{
|
||||
Api = api;
|
||||
Env = env;
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using zero.Core;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using zero.Core.Api;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
{
|
||||
public class SectionsController : BackofficeController
|
||||
{
|
||||
private ISectionsApi Api { get; set; }
|
||||
ISectionsApi Api;
|
||||
|
||||
public SectionsController(IZeroConfiguration config, ISectionsApi api) : base(config)
|
||||
public SectionsController(ISectionsApi api)
|
||||
{
|
||||
Api = api;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Identity;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -10,9 +6,9 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Sections.Settings, PermissionsValue.Read)]
|
||||
public class SettingsController : BackofficeController
|
||||
{
|
||||
private ISettingsApi Api { get; set; }
|
||||
ISettingsApi Api;
|
||||
|
||||
public SettingsController(IZeroConfiguration config, ISettingsApi api) : base(config)
|
||||
public SettingsController(ISettingsApi api)
|
||||
{
|
||||
Api = api;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Entities.Setup;
|
||||
@@ -17,24 +15,20 @@ namespace zero.Web.Setup
|
||||
[ZeroAuthorize(false)]
|
||||
public class SetupController : BackofficeController
|
||||
{
|
||||
protected ISetupApi Api { get; private set; }
|
||||
|
||||
protected IWebHostEnvironment Environment { get; private set; }
|
||||
|
||||
protected ZeroOptions Options { get; private set; }
|
||||
ISetupApi Api;
|
||||
IWebHostEnvironment Env;
|
||||
|
||||
|
||||
public SetupController(IZeroConfiguration config, ISetupApi api, IWebHostEnvironment env, IOptionsMonitor<ZeroOptions> options) : base(config) // UserManager<User> userManager
|
||||
public SetupController(ISetupApi api, IWebHostEnvironment env)
|
||||
{
|
||||
Api = api;
|
||||
Environment = env;
|
||||
Options = options.CurrentValue;
|
||||
Env = env;
|
||||
}
|
||||
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (!Configuration.ZeroVersion.IsNullOrEmpty())
|
||||
if (!Options.ZeroVersion.IsNullOrEmpty())
|
||||
{
|
||||
return Redirect(Options.BackofficePath);
|
||||
}
|
||||
@@ -46,7 +40,7 @@ namespace zero.Web.Setup
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Install([FromBody] SetupModel model)
|
||||
{
|
||||
model.ContentRootPath = Environment.ContentRootPath;
|
||||
model.ContentRootPath = Env.ContentRootPath;
|
||||
|
||||
EntityResult<SetupModel> result = await Api.Install(model);
|
||||
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Extensions;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Mapper;
|
||||
using zero.TestData;
|
||||
using zero.Web.Mapper;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -20,11 +13,10 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Sections.Spaces, PermissionsValue.True)]
|
||||
public class SpacesController : BackofficeController
|
||||
{
|
||||
private ISpacesApi Api { get; set; }
|
||||
ISpacesApi Api;
|
||||
IAuthenticationApi AuthenticationApi;
|
||||
|
||||
private IAuthenticationApi AuthenticationApi { get; set; }
|
||||
|
||||
public SpacesController(IZeroConfiguration config, ISpacesApi api, IAuthenticationApi authenticationApi, IMapper mapper, IToken token) : base(config, mapper, token)
|
||||
public SpacesController(ISpacesApi api, IAuthenticationApi authenticationApi)
|
||||
{
|
||||
Api = api;
|
||||
AuthenticationApi = authenticationApi;
|
||||
@@ -72,28 +64,28 @@ namespace zero.Web.Controllers
|
||||
/// <summary>
|
||||
/// Get list items in a space
|
||||
/// </summary>
|
||||
public async Task<IActionResult> GetContent([FromQuery] string alias, [FromQuery] string contentId = null)
|
||||
public IActionResult GetContent([FromQuery] string alias, [FromQuery] string contentId = null)
|
||||
{
|
||||
if (!CanReadSpace(alias))
|
||||
{
|
||||
return new StatusCodeResult(403);
|
||||
}
|
||||
|
||||
TeamMember model = new TeamMember();
|
||||
//TeamMember model = new TeamMember();
|
||||
|
||||
if (!contentId.IsNullOrEmpty())
|
||||
{
|
||||
model = await Api.GetItem<TeamMember>(alias, contentId);
|
||||
}
|
||||
//if (!contentId.IsNullOrEmpty())
|
||||
//{
|
||||
// model = await Api.GetItem<TeamMember>(alias, contentId);
|
||||
//}
|
||||
|
||||
JsonSerializerSettings settings = JsonConvert.DefaultSettings();
|
||||
settings.TypeNameHandling = TypeNameHandling.Objects;
|
||||
|
||||
return Json(new SpaceContentEditModel()
|
||||
{
|
||||
Id = model.Id,
|
||||
//Id = model.Id,
|
||||
Alias = alias,
|
||||
Model = model,
|
||||
//Model = model,
|
||||
Config = Api.GetEditorConfig(alias)
|
||||
}, settings);
|
||||
}
|
||||
|
||||
@@ -10,66 +10,59 @@ using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Renderer;
|
||||
using zero.TestData;
|
||||
using zero.TestData.Lists;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
{
|
||||
//[ZeroAuthorize("tobi")]
|
||||
public class TestController : BackofficeController
|
||||
{
|
||||
private IAuthenticationApi Api { get; set; }
|
||||
IAuthenticationApi Api;
|
||||
ISpacesApi SpacesApi;
|
||||
ILanguagesApi LanguagesApi;
|
||||
SignInManager<User> SignInManager;
|
||||
|
||||
private ISpacesApi SpacesApi { get; set; }
|
||||
|
||||
private ILanguagesApi LanguagesApi { get; set; }
|
||||
|
||||
private SignInManager<User> SignInManager;
|
||||
|
||||
private ZeroOptions Options;
|
||||
|
||||
public TestController(IZeroConfiguration config, IAuthenticationApi api, ISpacesApi spacesApi, ILanguagesApi languagesApi, SignInManager<User> signInManager, IOptionsMonitor<ZeroOptions> options) : base(config)
|
||||
public TestController(IAuthenticationApi api, ISpacesApi spacesApi, ILanguagesApi languagesApi, SignInManager<User> signInManager)
|
||||
{
|
||||
Api = api;
|
||||
SpacesApi = spacesApi;
|
||||
LanguagesApi = languagesApi;
|
||||
SignInManager = signInManager;
|
||||
Options = options.CurrentValue;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[ZeroAuthorize(false)]
|
||||
public IActionResult RenderConfig()
|
||||
{
|
||||
SocialContentRenderer renderer = new SocialContentRenderer();
|
||||
//[HttpGet]
|
||||
//[ZeroAuthorize(false)]
|
||||
//public IActionResult RenderConfig()
|
||||
//{
|
||||
// SocialContentRenderer renderer = new SocialContentRenderer();
|
||||
|
||||
return Json(renderer.Build());
|
||||
}
|
||||
// return Json(renderer.Build());
|
||||
//}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[ZeroAuthorize(false)]
|
||||
public async Task<IActionResult> SaveSpaceContent()
|
||||
{
|
||||
TeamMember model = new TeamMember()
|
||||
{
|
||||
IsActive = true,
|
||||
Email = "tobi@test.com",
|
||||
Name = "Tobi",
|
||||
Position = "Chef",
|
||||
VideoUri = "https://swcs.pro"
|
||||
};
|
||||
//[HttpGet]
|
||||
//[ZeroAuthorize(false)]
|
||||
//public async Task<IActionResult> SaveSpaceContent()
|
||||
//{
|
||||
// TeamMember model = new TeamMember()
|
||||
// {
|
||||
// IsActive = true,
|
||||
// Email = "tobi@test.com",
|
||||
// Name = "Tobi",
|
||||
// Position = "Chef",
|
||||
// VideoUri = "https://swcs.pro"
|
||||
// };
|
||||
|
||||
model.Addresses.Add(new TeamMemberAddress()
|
||||
{
|
||||
City = "Braunau",
|
||||
Street = "My street",
|
||||
No = "23"
|
||||
});
|
||||
// model.Addresses.Add(new TeamMemberAddress()
|
||||
// {
|
||||
// City = "Braunau",
|
||||
// Street = "My street",
|
||||
// No = "23"
|
||||
// });
|
||||
|
||||
return Json(await SpacesApi.Save("team", model));
|
||||
}
|
||||
// return Json(await SpacesApi.Save("team", model));
|
||||
//}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
@@ -87,12 +80,12 @@ namespace zero.Web.Controllers
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
[ZeroAuthorize(false)]
|
||||
public async Task<IActionResult> GetSpaceList()
|
||||
{
|
||||
return Json(await SpacesApi.GetList<TeamMember>("team"));
|
||||
}
|
||||
//[HttpGet]
|
||||
//[ZeroAuthorize(false)]
|
||||
//public async Task<IActionResult> GetSpaceList()
|
||||
//{
|
||||
// return Json(await SpacesApi.GetList<TeamMember>("team"));
|
||||
//}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
@@ -101,7 +94,7 @@ namespace zero.Web.Controllers
|
||||
{
|
||||
Space space = SpacesApi.GetByAlias(alias);
|
||||
|
||||
AbstractGenericRenderer renderer = Options.Renderers.FirstOrDefault(x => x.TargetType == space.Type);
|
||||
AbstractGenericRenderer renderer = Options.Backoffice.Renderers.FirstOrDefault(x => x.TargetType == space.Type);
|
||||
|
||||
if (renderer == null)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Mapper;
|
||||
using zero.Web.Mapper;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -14,15 +10,11 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Settings.Translations, PermissionsValue.Read)]
|
||||
public class TranslationsController : BackofficeController
|
||||
{
|
||||
private ITranslationsApi Api { get; set; }
|
||||
ITranslationsApi Api;
|
||||
|
||||
private ZeroOptions Options { get; set; }
|
||||
|
||||
|
||||
public TranslationsController(IZeroConfiguration config, ITranslationsApi api, IMapper mapper, IToken token, IOptionsMonitor<ZeroOptions> options) : base(config, mapper, token)
|
||||
public TranslationsController(ITranslationsApi api)
|
||||
{
|
||||
Api = api;
|
||||
Options = options.CurrentValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Mapper;
|
||||
using zero.Web.Filters;
|
||||
using zero.Web.Mapper;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -15,18 +10,14 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Settings.Users, PermissionsValue.Read)]
|
||||
public class UserRolesController : BackofficeController
|
||||
{
|
||||
private IUserRolesApi Api { get; set; }
|
||||
|
||||
private IPermissionsApi PermissionsApi { get; set; }
|
||||
|
||||
private ZeroOptions Options { get; set; }
|
||||
IUserRolesApi Api;
|
||||
IPermissionsApi PermissionsApi;
|
||||
|
||||
|
||||
public UserRolesController(IZeroConfiguration config, IUserRolesApi api, IPermissionsApi permissionsApi, IMapper mapper, IToken token, IOptionsMonitor<ZeroOptions> options) : base(config, mapper, token)
|
||||
public UserRolesController(IUserRolesApi api, IPermissionsApi permissionsApi)
|
||||
{
|
||||
Api = api;
|
||||
PermissionsApi = permissionsApi;
|
||||
Options = options.CurrentValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core;
|
||||
using zero.Core.Api;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Identity;
|
||||
using zero.Core.Mapper;
|
||||
using zero.Web.Mapper;
|
||||
using zero.Web.Models;
|
||||
|
||||
namespace zero.Web.Controllers
|
||||
@@ -14,24 +10,18 @@ namespace zero.Web.Controllers
|
||||
[ZeroAuthorize(Permissions.Settings.Users, PermissionsValue.Read)]
|
||||
public class UsersController : BackofficeController
|
||||
{
|
||||
IUserApi Api = null;
|
||||
|
||||
IAuthenticationApi AuthenticationApi = null;
|
||||
|
||||
IUserRolesApi RolesApi = null;
|
||||
|
||||
ILanguagesApi LanguagesApi = null;
|
||||
|
||||
ZeroOptions Options = null;
|
||||
IUserApi Api;
|
||||
IAuthenticationApi AuthenticationApi;
|
||||
IUserRolesApi RolesApi;
|
||||
ILanguagesApi LanguagesApi;
|
||||
|
||||
|
||||
public UsersController(IZeroConfiguration config, IUserApi api, IAuthenticationApi authenticationApi, IUserRolesApi rolesApi, ILanguagesApi languagesApi, IMapper mapper, IToken token, IOptionsMonitor<ZeroOptions> options) : base(config, mapper, token)
|
||||
public UsersController(IUserApi api, IAuthenticationApi authenticationApi, IUserRolesApi rolesApi, ILanguagesApi languagesApi)
|
||||
{
|
||||
Api = api;
|
||||
AuthenticationApi = authenticationApi;
|
||||
RolesApi = rolesApi;
|
||||
LanguagesApi = languagesApi;
|
||||
Options = options.CurrentValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +38,7 @@ namespace zero.Web.Controllers
|
||||
}
|
||||
|
||||
UserEditModel model = await Mapper.Map<User, UserEditModel>(user);
|
||||
model.SupportedCultures = LanguagesApi.GetAllCultures(Configuration.SupportedLanguages);
|
||||
model.SupportedCultures = LanguagesApi.GetAllCultures(Options.SupportedLanguages);
|
||||
|
||||
return Json(model);
|
||||
}
|
||||
@@ -68,7 +58,7 @@ namespace zero.Web.Controllers
|
||||
/// </summary>
|
||||
public IActionResult GetAllPermissions()
|
||||
{
|
||||
return Json(Options.Authorization.Permissions);
|
||||
return Json(Options.Backoffice.Permissions);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user