improve launcher auth and remote connection feedback
This commit is contained in:
@@ -61,6 +61,10 @@ export class AppsService {
|
||||
|
||||
async getApps(accessToken?: string) {
|
||||
const authUserId = await this.getAuthUserId(accessToken);
|
||||
if (authUserId) {
|
||||
await this.ensureDefaultAppViewPermissions(authUserId);
|
||||
}
|
||||
|
||||
const apps = await this.prisma.launcherApp.findMany({
|
||||
where: { isEnabled: true },
|
||||
orderBy: [{ sortOrder: 'asc' }, { displayName: 'asc' }],
|
||||
@@ -296,4 +300,22 @@ export class AppsService {
|
||||
|
||||
return Boolean(permission);
|
||||
}
|
||||
|
||||
private async ensureDefaultAppViewPermissions(authUserId: string) {
|
||||
const apps = await this.prisma.launcherApp.findMany({
|
||||
where: { isEnabled: true },
|
||||
select: { id: true },
|
||||
});
|
||||
if (!apps.length) return;
|
||||
|
||||
await this.prisma.launcherUserApp.createMany({
|
||||
data: apps.map((app) => ({
|
||||
authUserId,
|
||||
appId: app.id,
|
||||
canView: true,
|
||||
canLaunch: false,
|
||||
})),
|
||||
skipDuplicates: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user