added security attribute to TenantController Get methods and resolved TenantId on server during Installation

This commit is contained in:
Shaun Walker
2019-10-23 18:26:39 -04:00
parent 91c7528856
commit 414935dc58
4 changed files with 18 additions and 13 deletions

View File

@ -50,7 +50,10 @@ namespace Oqtane.Controllers
bool authorized;
if (!Sites.GetSites().Any())
{
authorized = true; // provision initial site during installation
// provision initial site during installation
authorized = true;
Tenant tenant = Tenants.GetTenant();
Site.TenantId = tenant.TenantId;
}
else
{

View File

@ -22,6 +22,7 @@ namespace Oqtane.Controllers
// GET: api/<controller>
[HttpGet]
[Authorize(Roles = Constants.HostRole)]
public IEnumerable<Tenant> Get()
{
return Tenants.GetTenants();
@ -29,6 +30,7 @@ namespace Oqtane.Controllers
// GET api/<controller>/5
[HttpGet("{id}")]
[Authorize(Roles = Constants.HostRole)]
public Tenant Get(int id)
{
return Tenants.GetTenant(id);