enhance UserRole service with filtering and moved workload to server for better performance, improve error message details during installation

This commit is contained in:
Shaun Walker
2022-04-29 21:39:11 -04:00
parent e8464206e7
commit a3ff9373a2
10 changed files with 179 additions and 57 deletions

View File

@ -16,7 +16,31 @@ namespace Oqtane.Services
public async Task<List<UserRole>> GetUserRolesAsync(int siteId)
{
return await GetJsonAsync<List<UserRole>>($"{Apiurl}?siteid={siteId}");
return await GetUserRolesAsync(siteId, -1, "");
}
public async Task<List<UserRole>> GetUserRolesAsync(int siteId, int userId)
{
return await GetUserRolesAsync(siteId, userId, "");
}
public async Task<List<UserRole>> GetUserRolesAsync(int siteId, string roleName)
{
return await GetUserRolesAsync(siteId, -1, roleName);
}
public async Task<List<UserRole>> GetUserRolesAsync(int siteId, int userId, string roleName)
{
var url = $"{Apiurl}?siteid={siteId}";
if (userId != -1)
{
url += $"&userid={userId}";
}
if (roleName != "")
{
url += $"&rolename={roleName}";
}
return await GetJsonAsync<List<UserRole>>(url);
}
public async Task<UserRole> GetUserRoleAsync(int userRoleId)