ensure auth access for builder and admins
This commit is contained in:
parent
6c555c121c
commit
690ff373cd
|
@ -43,26 +43,28 @@
|
||||||
)
|
)
|
||||||
let userApps = []
|
let userApps = []
|
||||||
$: publishedApps = $apps.filter(publishedAppsOnly)
|
$: publishedApps = $apps.filter(publishedAppsOnly)
|
||||||
|
$: console.log($auth.user)
|
||||||
$: {
|
$: {
|
||||||
if (!Object.keys($auth.user?.roles).length && $auth.user?.userGroups) {
|
if (!Object.keys($auth.user?.roles).length && $auth.user?.userGroups) {
|
||||||
userApps = $auth.user?.builder?.global
|
userApps =
|
||||||
? publishedApps
|
$auth.user?.builder?.global || $auth.user?.admin?.global
|
||||||
: publishedApps.filter(app => {
|
? publishedApps
|
||||||
return userGroups.find(group => {
|
: publishedApps.filter(app => {
|
||||||
return Object.keys(group.roles)
|
return userGroups.find(group => {
|
||||||
.map(role => apps.extractAppId(role))
|
return Object.keys(group.roles)
|
||||||
.includes(app.appId)
|
.map(role => apps.extractAppId(role))
|
||||||
|
.includes(app.appId)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
userApps = $auth.user?.builder?.global
|
userApps =
|
||||||
? publishedApps
|
$auth.user?.builder?.global || $auth.user?.admin?.global
|
||||||
: publishedApps.filter(app =>
|
? publishedApps
|
||||||
Object.keys($auth.user?.roles)
|
: publishedApps.filter(app =>
|
||||||
.map(x => apps.extractAppId(x))
|
Object.keys($auth.user?.roles)
|
||||||
.includes(app.appId)
|
.map(x => apps.extractAppId(x))
|
||||||
)
|
.includes(app.appId)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue