Guard
This commit is contained in:
parent
4329900a64
commit
1eb929736c
|
@ -1 +1 @@
|
||||||
Subproject commit d3c3077011a8e20ed3c48dcd6301caca4120b6ac
|
Subproject commit d67e126044bde383fb8c316c3c89a37fae74e349
|
|
@ -7,6 +7,7 @@ import {
|
||||||
ViewV2Enriched,
|
ViewV2Enriched,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { HTTPError, db as dbCore } from "@budibase/backend-core"
|
import { HTTPError, db as dbCore } from "@budibase/backend-core"
|
||||||
|
import { features } from "@budibase/pro"
|
||||||
import { cloneDeep } from "lodash"
|
import { cloneDeep } from "lodash"
|
||||||
|
|
||||||
import * as utils from "../../../db/utils"
|
import * as utils from "../../../db/utils"
|
||||||
|
@ -53,6 +54,13 @@ async function guardViewSchema(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewSchema[field].readonly) {
|
if (viewSchema[field].readonly) {
|
||||||
|
if (!(await features.isViewReadonlyColumnsEnabled())) {
|
||||||
|
throw new HTTPError(
|
||||||
|
`Readonly fields are not enabled for your tenant`,
|
||||||
|
400
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (isRequired(tableSchemaField.constraints)) {
|
if (isRequired(tableSchemaField.constraints)) {
|
||||||
throw new HTTPError(
|
throw new HTTPError(
|
||||||
`Field "${field}" cannot be readonly as it is a required field`,
|
`Field "${field}" cannot be readonly as it is a required field`,
|
||||||
|
|
Loading…
Reference in New Issue