feat(launchpad): populate all registered apps for Universal Sandbox guests on Launchpad and allow ForwardAuth access
This commit is contained in:
parent
c221e32855
commit
964dd74f72
@ -175,11 +175,22 @@ export const getDashboardApps = async (
|
|||||||
ORDER BY name ASC
|
ORDER BY name ASC
|
||||||
`;
|
`;
|
||||||
} else {
|
} else {
|
||||||
const appNames = (customScopes || [])
|
const scopes = customScopes || [];
|
||||||
|
const appNames = scopes
|
||||||
.filter((s) => s.startsWith("app:"))
|
.filter((s) => s.startsWith("app:"))
|
||||||
.map((s) => s.split(":")[1]);
|
.map((s) => s.split(":")[1]);
|
||||||
|
|
||||||
if (appNames.length > 0) {
|
const isUniversalGuest = scopes.includes("*") ||
|
||||||
|
(scopes.includes("guest") && appNames.length === 0);
|
||||||
|
|
||||||
|
if (isUniversalGuest) {
|
||||||
|
return await sqlWrapper.sql`
|
||||||
|
SELECT id, name, description, domain, 'Guest (Viewer)' as role
|
||||||
|
FROM apps
|
||||||
|
WHERE domain IS NOT NULL
|
||||||
|
ORDER BY name ASC
|
||||||
|
`;
|
||||||
|
} else if (appNames.length > 0) {
|
||||||
return await sqlWrapper.sql`
|
return await sqlWrapper.sql`
|
||||||
SELECT a.id, a.name, a.description, a.domain, g.role
|
SELECT a.id, a.name, a.description, a.domain, g.role
|
||||||
FROM apps a
|
FROM apps a
|
||||||
|
|||||||
@ -130,8 +130,11 @@ forwardAuthRoutes.get("/api/forward-auth", async (c) => {
|
|||||||
(auth.customScopes && auth.customScopes.length > 0)
|
(auth.customScopes && auth.customScopes.length > 0)
|
||||||
) {
|
) {
|
||||||
const customScopes = auth.customScopes || [];
|
const customScopes = auth.customScopes || [];
|
||||||
|
const isUniversalGuest = customScopes.includes("guest") &&
|
||||||
|
!customScopes.some((s) => s.startsWith("app:"));
|
||||||
const hasAppScope = customScopes.includes(`app:${appRecord.name}`) ||
|
const hasAppScope = customScopes.includes(`app:${appRecord.name}`) ||
|
||||||
customScopes.includes("*");
|
customScopes.includes("*") ||
|
||||||
|
isUniversalGuest;
|
||||||
|
|
||||||
if (!hasAppScope) {
|
if (!hasAppScope) {
|
||||||
return c.text(
|
return c.text(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user