Merge pull request #14953 from Budibase/chore/cleanup-TABLES_DEFAULT_ADMIN-flag
Remove TABLES_DEFAULT_ADMIN flag
This commit is contained in:
commit
ee4fbf0db2
|
@ -272,7 +272,6 @@ export const flags = new FlagSet({
|
||||||
[FeatureFlag.SQS]: Flag.boolean(true),
|
[FeatureFlag.SQS]: Flag.boolean(true),
|
||||||
[FeatureFlag.AI_CUSTOM_CONFIGS]: Flag.boolean(env.isDev()),
|
[FeatureFlag.AI_CUSTOM_CONFIGS]: Flag.boolean(env.isDev()),
|
||||||
[FeatureFlag.ENRICHED_RELATIONSHIPS]: Flag.boolean(env.isDev()),
|
[FeatureFlag.ENRICHED_RELATIONSHIPS]: Flag.boolean(env.isDev()),
|
||||||
[FeatureFlag.TABLES_DEFAULT_ADMIN]: Flag.boolean(env.isDev()),
|
|
||||||
[FeatureFlag.BUDIBASE_AI]: Flag.boolean(env.isDev()),
|
[FeatureFlag.BUDIBASE_AI]: Flag.boolean(env.isDev()),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { FeatureFlag, Row, Table } from "@budibase/types"
|
import { Row, Table } from "@budibase/types"
|
||||||
|
|
||||||
import * as external from "./external"
|
import * as external from "./external"
|
||||||
import * as internal from "./internal"
|
import * as internal from "./internal"
|
||||||
import { isExternal } from "./utils"
|
import { isExternal } from "./utils"
|
||||||
import { setPermissions } from "../permissions"
|
import { setPermissions } from "../permissions"
|
||||||
import { features, roles } from "@budibase/backend-core"
|
import { roles } from "@budibase/backend-core"
|
||||||
|
|
||||||
export async function create(
|
export async function create(
|
||||||
table: Omit<Table, "_id" | "_rev">,
|
table: Omit<Table, "_id" | "_rev">,
|
||||||
|
@ -18,16 +18,10 @@ export async function create(
|
||||||
createdTable = await internal.create(table, rows, userId)
|
createdTable = await internal.create(table, rows, userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setExplicitPermission = await features.flags.isEnabled(
|
|
||||||
FeatureFlag.TABLES_DEFAULT_ADMIN
|
|
||||||
)
|
|
||||||
|
|
||||||
if (setExplicitPermission) {
|
|
||||||
await setPermissions(createdTable._id!, {
|
await setPermissions(createdTable._id!, {
|
||||||
writeRole: roles.BUILTIN_ROLE_IDS.ADMIN,
|
writeRole: roles.BUILTIN_ROLE_IDS.ADMIN,
|
||||||
readRole: roles.BUILTIN_ROLE_IDS.ADMIN,
|
readRole: roles.BUILTIN_ROLE_IDS.ADMIN,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
return createdTable
|
return createdTable
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import {
|
||||||
BBReferenceFieldSubType,
|
BBReferenceFieldSubType,
|
||||||
CalculationType,
|
CalculationType,
|
||||||
canGroupBy,
|
canGroupBy,
|
||||||
FeatureFlag,
|
|
||||||
FieldType,
|
FieldType,
|
||||||
isNumeric,
|
isNumeric,
|
||||||
PermissionLevel,
|
PermissionLevel,
|
||||||
|
@ -16,7 +15,7 @@ import {
|
||||||
ViewV2ColumnEnriched,
|
ViewV2ColumnEnriched,
|
||||||
ViewV2Enriched,
|
ViewV2Enriched,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { context, docIds, features, HTTPError } from "@budibase/backend-core"
|
import { context, docIds, HTTPError } from "@budibase/backend-core"
|
||||||
import {
|
import {
|
||||||
helpers,
|
helpers,
|
||||||
PROTECTED_EXTERNAL_COLUMNS,
|
PROTECTED_EXTERNAL_COLUMNS,
|
||||||
|
@ -287,17 +286,12 @@ export async function create(
|
||||||
await guardViewSchema(tableId, viewRequest)
|
await guardViewSchema(tableId, viewRequest)
|
||||||
const view = await pickApi(tableId).create(tableId, viewRequest)
|
const view = await pickApi(tableId).create(tableId, viewRequest)
|
||||||
|
|
||||||
const setExplicitPermission = await features.flags.isEnabled(
|
|
||||||
FeatureFlag.TABLES_DEFAULT_ADMIN
|
|
||||||
)
|
|
||||||
if (setExplicitPermission) {
|
|
||||||
// Set permissions to be the same as the table
|
// Set permissions to be the same as the table
|
||||||
const tablePerms = await sdk.permissions.getResourcePerms(tableId)
|
const tablePerms = await sdk.permissions.getResourcePerms(tableId)
|
||||||
await sdk.permissions.setPermissions(view.id, {
|
await sdk.permissions.setPermissions(view.id, {
|
||||||
writeRole: tablePerms[PermissionLevel.WRITE].role,
|
writeRole: tablePerms[PermissionLevel.WRITE].role,
|
||||||
readRole: tablePerms[PermissionLevel.READ].role,
|
readRole: tablePerms[PermissionLevel.READ].role,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ export enum FeatureFlag {
|
||||||
AI_CUSTOM_CONFIGS = "AI_CUSTOM_CONFIGS",
|
AI_CUSTOM_CONFIGS = "AI_CUSTOM_CONFIGS",
|
||||||
DEFAULT_VALUES = "DEFAULT_VALUES",
|
DEFAULT_VALUES = "DEFAULT_VALUES",
|
||||||
ENRICHED_RELATIONSHIPS = "ENRICHED_RELATIONSHIPS",
|
ENRICHED_RELATIONSHIPS = "ENRICHED_RELATIONSHIPS",
|
||||||
TABLES_DEFAULT_ADMIN = "TABLES_DEFAULT_ADMIN",
|
|
||||||
BUDIBASE_AI = "BUDIBASE_AI",
|
BUDIBASE_AI = "BUDIBASE_AI",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue