Revert "Do not show all apps in Server settings policy"

This reverts commit 1619666bef.
This commit is contained in:
nicolas.dorier
2019-04-12 14:43:07 +09:00
parent 1619666bef
commit c55f1185e6
2 changed files with 22 additions and 24 deletions

View File

@@ -208,12 +208,12 @@ namespace BTCPayServer.Services.Apps
}
}
public async Task<ListAppsViewModel.ListAppViewModel[]> GetAllApps(string userId)
public async Task<ListAppsViewModel.ListAppViewModel[]> GetAllApps(string userId, bool allowNoUser = false)
{
using (var ctx = _ContextFactory.CreateContext())
{
return await ctx.UserStore
.Where(us => us.ApplicationUserId == userId)
.Where(us => (allowNoUser && string.IsNullOrEmpty(userId)) || us.ApplicationUserId == userId)
.Join(ctx.Apps, us => us.StoreDataId, app => app.StoreDataId,
(us, app) =>
new ListAppsViewModel.ListAppViewModel()
@@ -230,15 +230,13 @@ namespace BTCPayServer.Services.Apps
}
public async Task<AppData> GetApp(string appId, AppType? appType, bool includeStore = false)
public async Task<AppData> GetApp(string appId, AppType appType, bool includeStore = false)
{
using (var ctx = _ContextFactory.CreateContext())
{
var query = ctx.Apps
.Where(us => us.Id == appId);
if (appType is AppType appTypeValue)
query = query.Where(us => us.AppType == appTypeValue.ToString());
.Where(us => us.Id == appId &&
us.AppType == appType.ToString());
if (includeStore)
{