Skip to content

Commit

Permalink
Merge pull request #14913 from Budibase/revert-14911-2.33.4-uno-revert-4
Browse files Browse the repository at this point in the history
Revert "Revert to state from 2.33.4."
  • Loading branch information
mike12345567 authored Oct 29, 2024
2 parents 820f9c3 + 8e0ebba commit ab34224
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy QA
on:
push:
branches:
- v3-ui
- feature/automation-branching-ux
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion hosting/single/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN ./scripts/removeWorkspaceDependencies.sh packages/worker/package.json

RUN jq 'del(.scripts.postinstall)' package.json > temp.json && mv temp.json package.json
RUN ./scripts/removeWorkspaceDependencies.sh package.json
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production --frozen-lockfile
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production --frozen-lockfile --network-concurrency 1

# copy the actual code
COPY packages/server/dist packages/server/dist
Expand Down
31 changes: 20 additions & 11 deletions packages/backend-core/src/security/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ export function getBuiltinRole(roleId: string): Role | undefined {
export function builtinRoleToNumber(id: string) {
const builtins = getBuiltinRoles()
const MAX = Object.values(builtins).length + 1
if (id === BUILTIN_IDS.ADMIN || id === BUILTIN_IDS.BUILDER) {
if (
compareRoleIds(id, BUILTIN_IDS.ADMIN) ||
compareRoleIds(id, BUILTIN_IDS.BUILDER)
) {
return MAX
}
let role = builtins[id],
Expand Down Expand Up @@ -256,7 +259,9 @@ export async function roleToNumber(id: string) {
// find the built-in roles, get their number, sort it, then get the last one
const highestBuiltin: number | undefined = role.inherits
.map(roleId => {
const foundRole = hierarchy.find(role => role._id === roleId)
const foundRole = hierarchy.find(role =>
compareRoleIds(role._id!, roleId)
)
if (foundRole) {
return findNumber(foundRole) + 1
}
Expand Down Expand Up @@ -380,7 +385,7 @@ async function getAllUserRoles(
): Promise<RoleDoc[]> {
const allRoles = await getAllRoles()
// admins have access to all roles
if (userRoleId === BUILTIN_IDS.ADMIN) {
if (compareRoleIds(userRoleId, BUILTIN_IDS.ADMIN)) {
return allRoles
}

Expand Down Expand Up @@ -491,17 +496,21 @@ export async function getAllRoles(appId?: string): Promise<RoleDoc[]> {
// need to combine builtin with any DB record of them (for sake of permissions)
for (let builtinRoleId of externalBuiltinRoles) {
const builtinRole = builtinRoles[builtinRoleId]
const dbBuiltin = roles.filter(
dbRole =>
getExternalRoleID(dbRole._id!, dbRole.version) === builtinRoleId
const dbBuiltin = roles.filter(dbRole =>
compareRoleIds(dbRole._id!, builtinRoleId)
)[0]
if (dbBuiltin == null) {
roles.push(builtinRole || builtinRoles.BASIC)
} else {
// remove role and all back after combining with the builtin
roles = roles.filter(role => role._id !== dbBuiltin._id)
dbBuiltin._id = getExternalRoleID(dbBuiltin._id!, dbBuiltin.version)
roles.push(Object.assign(builtinRole, dbBuiltin))
dbBuiltin._id = getExternalRoleID(builtinRole._id!, dbBuiltin.version)
roles.push({
...builtinRole,
...dbBuiltin,
name: builtinRole.name,
_id: getExternalRoleID(builtinRole._id!, builtinRole.version),
})
}
}
// check permissions
Expand Down Expand Up @@ -544,9 +553,9 @@ export class AccessController {
if (
tryingRoleId == null ||
tryingRoleId === "" ||
tryingRoleId === userRoleId ||
tryingRoleId === BUILTIN_IDS.BUILDER ||
userRoleId === BUILTIN_IDS.BUILDER
compareRoleIds(tryingRoleId, BUILTIN_IDS.BUILDER) ||
compareRoleIds(userRoleId!, tryingRoleId) ||
compareRoleIds(userRoleId!, BUILTIN_IDS.BUILDER)
) {
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
let loaded = false
$: app = $appsStore.apps.find(app => $appStore.appId?.includes(app.appId))
$: licensePlan = $auth.user?.license?.plan
// Reset the page every time that a filter gets updated
$: pageInfo.reset(), automationId, status, timeRange
$: page = $pageInfo.page
$: fetchLogs(automationId, status, page, timeRange)
$: isCloud = $admin.cloud
Expand Down
28 changes: 17 additions & 11 deletions packages/builder/src/pages/builder/portal/users/users/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
]
let userData = []
let invitesLoaded = false
let tenantOwnerLoaded = false
let pendingInvites = []
let parsedInvites = []
Expand Down Expand Up @@ -100,13 +99,9 @@
$: pendingSchema = getPendingSchema(schema)
$: userData = []
$: inviteUsersResponse = { successful: [], unsuccessful: [] }
$: setEnrichedUsers($fetch.rows, tenantOwnerLoaded)
$: setEnrichedUsers($fetch.rows, tenantOwner)
const setEnrichedUsers = async rows => {
if (!tenantOwnerLoaded) {
enrichedUsers = []
return
}
const setEnrichedUsers = async (rows, owner) => {
enrichedUsers = rows?.map(user => {
let userGroups = []
$groups.forEach(group => {
Expand All @@ -118,7 +113,9 @@
})
}
})
user.tenantOwnerEmail = tenantOwner?.email
if (owner) {
user.tenantOwnerEmail = owner.email
}
const role = Constants.ExtendedBudibaseRoleOptions.find(
x => x.value === users.getUserRole(user)
)
Expand Down Expand Up @@ -322,12 +319,21 @@
try {
await groups.actions.init()
groupsLoaded = true
} catch (error) {
notifications.error("Error fetching user group data")
}
try {
pendingInvites = await users.getInvites()
invitesLoaded = true
} catch (err) {
notifications.error("Error fetching user invitations")
}
try {
tenantOwner = await users.getAccountHolder()
tenantOwnerLoaded = true
} catch (error) {
notifications.error("Error fetching user group data")
} catch (err) {
if (err.status !== 404) {
notifications.error("Error fetching account holder")
}
}
})
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@
$: debouncedFetchRows(searchTerm, primaryDisplay, defaultValue)
const forceFetchRows = async () => {
// if the filter has changed, then we need to reset the options, clear the selection, and re-fetch
optionsObj = {}
fieldApi?.setValue([])
selectedValue = []
debouncedFetchRows(searchTerm, primaryDisplay, defaultValue)
}
const fetchRows = async (searchTerm, primaryDisplay, defaultVal) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-core/src/fetch/UserFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class UserFetch extends DataFetch {
const { cursor, query } = get(this.store)
let finalQuery
// convert old format to new one - we now allow use of the lucene format
const { appId, paginated, ...rest } = query
const { appId, paginated, ...rest } = query || {}
if (!QueryUtils.hasFilters(query) && rest.email != null) {
finalQuery = { string: { email: rest.email } }
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/pro
Submodule pro updated from f6aebb to 2ab853
2 changes: 1 addition & 1 deletion packages/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RUN chmod +x ./scripts/removeWorkspaceDependencies.sh
RUN ./scripts/removeWorkspaceDependencies.sh package.json

# Install yarn packages with caching
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000 \
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000 --network-concurrency 1 \
&& yarn cache clean \
&& apk del g++ make python3 jq \
&& rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ COPY packages/worker/dist/yarn.lock .

RUN ../scripts/removeWorkspaceDependencies.sh package.json

RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000 --network-concurrency 1
# Remove unneeded data from file system to reduce image size
RUN apk del .gyp \
&& yarn cache clean
Expand Down

0 comments on commit ab34224

Please sign in to comment.