Refactor host user security model, support static assets in modules and themes, module definition permissions and categories, paging control, remove SiteUsers, move seed data from script to site template for installation

This commit is contained in:
Shaun Walker
2019-09-19 16:33:48 -04:00
parent 35b9b9e89b
commit 83a212e7e3
61 changed files with 1000 additions and 979 deletions

View File

@ -6,7 +6,8 @@ namespace Oqtane.Services
{
public interface IModuleDefinitionService
{
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync();
Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int SiteId);
Task UpdateModuleDefinitionAsync(ModuleDefinition ModuleDefinition);
Task InstallModulesAsync();
}
}

View File

@ -9,5 +9,7 @@ namespace Oqtane.Services
Task<List<Tenant>> GetTenantsAsync();
Task<Tenant> GetTenantAsync();
Task<Tenant> AddTenantAsync(Tenant Tenant);
}
}

View File

@ -7,7 +7,7 @@ namespace Oqtane.Services
public interface IUserRoleService
{
Task<List<UserRole>> GetUserRolesAsync();
Task<List<UserRole>> GetUserRolesAsync(int UserId);
Task<List<UserRole>> GetUserRolesAsync(int SiteId);
Task<UserRole> GetUserRoleAsync(int UserRoleId);
Task<UserRole> AddUserRoleAsync(UserRole UserRole);
Task<UserRole> UpdateUserRoleAsync(UserRole UserRole);

View File

@ -6,7 +6,7 @@ namespace Oqtane.Services
{
public interface IUserService
{
Task<List<User>> GetUsersAsync(int SiteId);
Task<List<User>> GetUsersAsync();
Task<User> GetUserAsync(int UserId, int SiteId);

View File

@ -28,10 +28,10 @@ namespace Oqtane.Services
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "ModuleDefinition"); }
}
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync()
public async Task<List<ModuleDefinition>> GetModuleDefinitionsAsync(int SiteId)
{
// get list of modules from the server
List<ModuleDefinition> moduledefinitions = await http.GetJsonAsync<List<ModuleDefinition>>(apiurl);
List<ModuleDefinition> moduledefinitions = await http.GetJsonAsync<List<ModuleDefinition>>(apiurl + "?siteid=" + SiteId.ToString());
// get list of loaded assemblies on the client ( in the client-side hosting module the browser client has its own app domain )
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
@ -64,6 +64,11 @@ namespace Oqtane.Services
return moduledefinitions.OrderBy(item => item.Name).ToList();
}
public async Task UpdateModuleDefinitionAsync(ModuleDefinition ModuleDefinition)
{
await http.PutJsonAsync<Page>(apiurl + "/" + ModuleDefinition.ModuleDefinitionId.ToString(), ModuleDefinition);
}
public async Task InstallModulesAsync()
{
await http.GetJsonAsync<List<string>>(apiurl + "/install");

View File

@ -36,5 +36,10 @@ namespace Oqtane.Services
{
return await http.GetJsonAsync<Tenant>(apiurl);
}
public async Task<Tenant> AddTenantAsync(Tenant Tenant)
{
return await http.PostJsonAsync<Tenant>(apiurl, Tenant);
}
}
}

View File

@ -31,9 +31,9 @@ namespace Oqtane.Services
return await http.GetJsonAsync<List<UserRole>>(apiurl);
}
public async Task<List<UserRole>> GetUserRolesAsync(int UserId)
public async Task<List<UserRole>> GetUserRolesAsync(int SiteId)
{
return await http.GetJsonAsync<List<UserRole>>(apiurl + "?userid=" + UserId.ToString());
return await http.GetJsonAsync<List<UserRole>>(apiurl + "?siteid=" + SiteId.ToString());
}
public async Task<UserRole> GetUserRoleAsync(int UserRoleId)

View File

@ -27,9 +27,9 @@ namespace Oqtane.Services
get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "User"); }
}
public async Task<List<User>> GetUsersAsync(int SiteId)
public async Task<List<User>> GetUsersAsync()
{
List<User> users = await http.GetJsonAsync<List<User>>(apiurl + "?siteid=" + SiteId.ToString());
List<User> users = await http.GetJsonAsync<List<User>>(apiurl);
return users.OrderBy(item => item.DisplayName).ToList();
}