stop matching on prodId in some cases
This commit is contained in:
parent
ea061e6ab1
commit
2d5dfcb9a2
|
@ -50,14 +50,14 @@
|
||||||
? publishedApps
|
? publishedApps
|
||||||
: publishedApps.filter(app => {
|
: publishedApps.filter(app => {
|
||||||
return userGroups.find(group => {
|
return userGroups.find(group => {
|
||||||
return Object.keys(group.roles).includes(app.prodId)
|
return Object.keys(group.roles).includes(app.appId)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
userApps = $auth.user?.builder?.global
|
userApps = $auth.user?.builder?.global
|
||||||
? publishedApps
|
? publishedApps
|
||||||
: publishedApps.filter(app =>
|
: publishedApps.filter(app =>
|
||||||
Object.keys($auth.user?.roles).includes(app.prodId)
|
Object.keys($auth.user?.roles).includes(app.appId)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,10 +176,10 @@
|
||||||
>
|
>
|
||||||
<div class="title ">
|
<div class="title ">
|
||||||
<StatusLight
|
<StatusLight
|
||||||
color={RoleUtils.getRoleColour(group.roles[app.prodId])}
|
color={RoleUtils.getRoleColour(group.roles[app.appId])}
|
||||||
/>
|
/>
|
||||||
<div style="margin-left: var(--spacing-s);">
|
<div style="margin-left: var(--spacing-s);">
|
||||||
<Body size="XS">{group.roles[app.prodId]}</Body>
|
<Body size="XS">{group.roles[app.appId]}</Body>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if hasGroupsLicense}
|
{#if hasGroupsLicense && $groups.length}
|
||||||
<div class="groupTable">
|
<div class="groupTable">
|
||||||
{#each $groups as group}
|
{#each $groups as group}
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
import { roles } from "stores/backend"
|
import { roles } from "stores/backend"
|
||||||
|
|
||||||
export let app
|
export let app
|
||||||
|
$: console.log(app._id)
|
||||||
let assignmentModal
|
let assignmentModal
|
||||||
let appGroups = []
|
let appGroups = []
|
||||||
let appUsers = []
|
let appUsers = []
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
$: appUsers =
|
$: appUsers =
|
||||||
$users.data?.filter(x => {
|
$users.data?.filter(x => {
|
||||||
return Object.keys(x.roles).find(y => {
|
return Object.keys(x.roles).find(y => {
|
||||||
return y === app.prodId
|
return y === app.appId
|
||||||
})
|
})
|
||||||
}) || []
|
}) || []
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@
|
||||||
return group._id === data.id
|
return group._id === data.id
|
||||||
})
|
})
|
||||||
matchedGroup.apps.push(app)
|
matchedGroup.apps.push(app)
|
||||||
matchedGroup.roles[app.prodId] = data.role
|
matchedGroup.roles[app.appId] = data.role
|
||||||
|
|
||||||
groups.actions.save(matchedGroup)
|
groups.actions.save(matchedGroup)
|
||||||
} else if (data.id.startsWith(us_prefix)) {
|
} else if (data.id.startsWith(us_prefix)) {
|
||||||
|
@ -67,27 +68,27 @@
|
||||||
|
|
||||||
let newUser = {
|
let newUser = {
|
||||||
...matchedUser,
|
...matchedUser,
|
||||||
roles: { [app.prodId]: data.role, ...matchedUser.roles },
|
roles: { [app.appId]: data.role, ...matchedUser.roles },
|
||||||
}
|
}
|
||||||
|
|
||||||
await users.save(newUser)
|
await users.save(newUser)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
await groups.actions.init()
|
await groups.actions.init()
|
||||||
await users.search({ page, appId: app.prodId })
|
await users.search({ page, appId: app.appId })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeUser(user) {
|
async function removeUser(user) {
|
||||||
// Remove the user role
|
// Remove the user role
|
||||||
const filteredRoles = { ...user.roles }
|
const filteredRoles = { ...user.roles }
|
||||||
delete filteredRoles[app?.prodId]
|
delete filteredRoles[app?.appId]
|
||||||
await users.save({
|
await users.save({
|
||||||
...user,
|
...user,
|
||||||
roles: {
|
roles: {
|
||||||
...filteredRoles,
|
...filteredRoles,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
await users.search({ page, appId: app.prodId })
|
await users.search({ page, appId: app.appId })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeGroup(group) {
|
async function removeGroup(group) {
|
||||||
|
@ -95,7 +96,7 @@
|
||||||
|
|
||||||
let filteredApps = group.apps.filter(x => x.appId !== app.appId)
|
let filteredApps = group.apps.filter(x => x.appId !== app.appId)
|
||||||
const filteredRoles = { ...group.roles }
|
const filteredRoles = { ...group.roles }
|
||||||
delete filteredRoles[app?.prodId]
|
delete filteredRoles[app?.appId]
|
||||||
|
|
||||||
await groups.actions.save({
|
await groups.actions.save({
|
||||||
...group,
|
...group,
|
||||||
|
@ -103,16 +104,16 @@
|
||||||
roles: { ...filteredRoles },
|
roles: { ...filteredRoles },
|
||||||
})
|
})
|
||||||
|
|
||||||
await users.search({ page, appId: app.prodId })
|
await users.search({ page, appId: app.appId })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateUserRole(role, user) {
|
async function updateUserRole(role, user) {
|
||||||
user.roles[app.prodId] = role
|
user.roles[app.appId] = role
|
||||||
users.save(user)
|
users.save(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateGroupRole(role, group) {
|
async function updateGroupRole(role, group) {
|
||||||
group.roles[app.prodId] = role
|
group.roles[app.appId] = role
|
||||||
groups.actions.save(group)
|
groups.actions.save(group)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +129,7 @@
|
||||||
prevSearch = search
|
prevSearch = search
|
||||||
try {
|
try {
|
||||||
pageInfo.loading()
|
pageInfo.loading()
|
||||||
await users.search({ page, appId: app.prodId })
|
await users.search({ page, appId: app.appId })
|
||||||
pageInfo.fetched($users.hasNextPage, $users.nextPage)
|
pageInfo.fetched($users.hasNextPage, $users.nextPage)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error getting user list")
|
notifications.error("Error getting user list")
|
||||||
|
@ -173,7 +174,7 @@
|
||||||
autoWidth
|
autoWidth
|
||||||
quiet
|
quiet
|
||||||
value={group.roles[
|
value={group.roles[
|
||||||
Object.keys(group.roles).find(x => x === app.prodId)
|
Object.keys(group.roles).find(x => x === app.appId)
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
|
@ -195,7 +196,7 @@
|
||||||
autoWidth
|
autoWidth
|
||||||
quiet
|
quiet
|
||||||
value={user.roles[
|
value={user.roles[
|
||||||
Object.keys(user.roles).find(x => x === app.prodId)
|
Object.keys(user.roles).find(x => x === app.appId)
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<Icon
|
<Icon
|
||||||
|
|
|
@ -1096,12 +1096,12 @@
|
||||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||||
|
|
||||||
"@budibase/backend-core@1.1.17":
|
"@budibase/backend-core@1.1.18-alpha.0":
|
||||||
version "1.1.17"
|
version "1.1.18-alpha.0"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.17.tgz#5102a6b457823735e4da71eb9bca8218a667f57b"
|
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.18-alpha.0.tgz#1b946ceccb798f3641fa35f11b2dda3ae0239d7a"
|
||||||
integrity sha512-SQQA3IvlD+ARMIXnAErFzOAzC67e9hM72qgZvOc3cqfBpvObSg1VnmNAuuG4GB0y3dm21ldLpCBQFzPH2Ylkkg==
|
integrity sha512-dpRmrcjs63tmljlfKZABhjV9E9GqmFaiCa7+wyobgB90TPfs3RVJD1lxk4R15jjTEUn/G518cK05+xZhTVi7TQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/types" "^1.1.17"
|
"@budibase/types" "^1.1.18-alpha.0"
|
||||||
"@techpass/passport-openidconnect" "0.3.2"
|
"@techpass/passport-openidconnect" "0.3.2"
|
||||||
aws-sdk "2.1030.0"
|
aws-sdk "2.1030.0"
|
||||||
bcrypt "5.0.1"
|
bcrypt "5.0.1"
|
||||||
|
@ -1179,13 +1179,13 @@
|
||||||
svelte-flatpickr "^3.2.3"
|
svelte-flatpickr "^3.2.3"
|
||||||
svelte-portal "^1.0.0"
|
svelte-portal "^1.0.0"
|
||||||
|
|
||||||
"@budibase/pro@1.1.17":
|
"@budibase/pro@1.1.18-alpha.0":
|
||||||
version "1.1.17"
|
version "1.1.18-alpha.0"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.17.tgz#6d6493b4df1c796469c0925c9d7b83e5f12b7b92"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.18-alpha.0.tgz#b0e6c2bec10139373e3c02be7ed239adc34e53a9"
|
||||||
integrity sha512-k0tfmeTf1Hh6m9U17wpUqfC0U2XvwhIf1Bbh7cbk8c41esm8blO0LxRpQGCS49lM85bfMFJvAGDr3+BHkiN7HA==
|
integrity sha512-zHdI1RjNqSAE4h4tSH3WCCtGSGc1QZuQ7zUf6MvhduhCSm06dLMUdgbXB5iMbUcorokeIONXvKFHfPZ2JsctSw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/backend-core" "1.1.17"
|
"@budibase/backend-core" "1.1.18-alpha.0"
|
||||||
"@budibase/types" "1.1.17"
|
"@budibase/types" "1.1.18-alpha.0"
|
||||||
node-fetch "^2.6.1"
|
node-fetch "^2.6.1"
|
||||||
|
|
||||||
"@budibase/standard-components@^0.9.139":
|
"@budibase/standard-components@^0.9.139":
|
||||||
|
@ -1206,10 +1206,15 @@
|
||||||
svelte-apexcharts "^1.0.2"
|
svelte-apexcharts "^1.0.2"
|
||||||
svelte-flatpickr "^3.1.0"
|
svelte-flatpickr "^3.1.0"
|
||||||
|
|
||||||
"@budibase/types@1.1.17", "@budibase/types@^1.1.17":
|
"@budibase/types@1.1.18-alpha.0":
|
||||||
version "1.1.17"
|
version "1.1.18-alpha.0"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.17.tgz#fa58e86f3858c04a8b79094193ff87ac57a499fe"
|
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.18-alpha.0.tgz#73fb24d304ea18e04605e22aafea41094ebeb10c"
|
||||||
integrity sha512-3sTH3tjPd+NEk5CIN23bgwyGXXNYq/hwaxKMbYLKGr45K6m9WDZs6saWxJ2JwguNtKGB9RggzCVR/DFJH2zI1A==
|
integrity sha512-B/4PgNu/yxsUcrLZMafU5dxPrJ3G2N2ajUDOtOv2fIwNATZRMXEacYe8cpndKxKriIOE4A8zGKwpKO7rIPqHvA==
|
||||||
|
|
||||||
|
"@budibase/types@^1.1.18-alpha.0":
|
||||||
|
version "1.1.19"
|
||||||
|
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.19.tgz#770b83f971e3e949a43b7d3564cbaed4462dd834"
|
||||||
|
integrity sha512-rFGe/RvcpV40CJ6Ng3RZSqj07GFAlzDyo116o/jQIskOew/SfBrIPaENEqk0wFPVL2pcZMpySXHNa86asqmUiw==
|
||||||
|
|
||||||
"@bull-board/api@3.7.0":
|
"@bull-board/api@3.7.0":
|
||||||
version "3.7.0"
|
version "3.7.0"
|
||||||
|
|
|
@ -291,12 +291,12 @@
|
||||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||||
|
|
||||||
"@budibase/backend-core@1.1.17":
|
"@budibase/backend-core@1.1.18-alpha.0":
|
||||||
version "1.1.17"
|
version "1.1.18-alpha.0"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.17.tgz#5102a6b457823735e4da71eb9bca8218a667f57b"
|
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.18-alpha.0.tgz#1b946ceccb798f3641fa35f11b2dda3ae0239d7a"
|
||||||
integrity sha512-SQQA3IvlD+ARMIXnAErFzOAzC67e9hM72qgZvOc3cqfBpvObSg1VnmNAuuG4GB0y3dm21ldLpCBQFzPH2Ylkkg==
|
integrity sha512-dpRmrcjs63tmljlfKZABhjV9E9GqmFaiCa7+wyobgB90TPfs3RVJD1lxk4R15jjTEUn/G518cK05+xZhTVi7TQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/types" "^1.1.17"
|
"@budibase/types" "^1.1.18-alpha.0"
|
||||||
"@techpass/passport-openidconnect" "0.3.2"
|
"@techpass/passport-openidconnect" "0.3.2"
|
||||||
aws-sdk "2.1030.0"
|
aws-sdk "2.1030.0"
|
||||||
bcrypt "5.0.1"
|
bcrypt "5.0.1"
|
||||||
|
@ -324,19 +324,24 @@
|
||||||
uuid "8.3.2"
|
uuid "8.3.2"
|
||||||
zlib "1.0.5"
|
zlib "1.0.5"
|
||||||
|
|
||||||
"@budibase/pro@1.1.17":
|
"@budibase/pro@1.1.18-alpha.0":
|
||||||
version "1.1.17"
|
version "1.1.18-alpha.0"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.17.tgz#6d6493b4df1c796469c0925c9d7b83e5f12b7b92"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.18-alpha.0.tgz#b0e6c2bec10139373e3c02be7ed239adc34e53a9"
|
||||||
integrity sha512-k0tfmeTf1Hh6m9U17wpUqfC0U2XvwhIf1Bbh7cbk8c41esm8blO0LxRpQGCS49lM85bfMFJvAGDr3+BHkiN7HA==
|
integrity sha512-zHdI1RjNqSAE4h4tSH3WCCtGSGc1QZuQ7zUf6MvhduhCSm06dLMUdgbXB5iMbUcorokeIONXvKFHfPZ2JsctSw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/backend-core" "1.1.17"
|
"@budibase/backend-core" "1.1.18-alpha.0"
|
||||||
"@budibase/types" "1.1.17"
|
"@budibase/types" "1.1.18-alpha.0"
|
||||||
node-fetch "^2.6.1"
|
node-fetch "^2.6.1"
|
||||||
|
|
||||||
"@budibase/types@1.1.17", "@budibase/types@^1.1.17":
|
"@budibase/types@1.1.18-alpha.0":
|
||||||
version "1.1.17"
|
version "1.1.18-alpha.0"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.17.tgz#fa58e86f3858c04a8b79094193ff87ac57a499fe"
|
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.18-alpha.0.tgz#73fb24d304ea18e04605e22aafea41094ebeb10c"
|
||||||
integrity sha512-3sTH3tjPd+NEk5CIN23bgwyGXXNYq/hwaxKMbYLKGr45K6m9WDZs6saWxJ2JwguNtKGB9RggzCVR/DFJH2zI1A==
|
integrity sha512-B/4PgNu/yxsUcrLZMafU5dxPrJ3G2N2ajUDOtOv2fIwNATZRMXEacYe8cpndKxKriIOE4A8zGKwpKO7rIPqHvA==
|
||||||
|
|
||||||
|
"@budibase/types@^1.1.18-alpha.0":
|
||||||
|
version "1.1.19"
|
||||||
|
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.19.tgz#770b83f971e3e949a43b7d3564cbaed4462dd834"
|
||||||
|
integrity sha512-rFGe/RvcpV40CJ6Ng3RZSqj07GFAlzDyo116o/jQIskOew/SfBrIPaENEqk0wFPVL2pcZMpySXHNa86asqmUiw==
|
||||||
|
|
||||||
"@cspotcode/source-map-consumer@0.8.0":
|
"@cspotcode/source-map-consumer@0.8.0":
|
||||||
version "0.8.0"
|
version "0.8.0"
|
||||||
|
|
Loading…
Reference in New Issue