|
|
|
@ -5,7 +5,9 @@ import {
|
|
|
|
|
isCreatedOrLastModifiedTimeCol, |
|
|
|
|
isLinksOrLTAR, |
|
|
|
|
isVirtualCol, |
|
|
|
|
readonlyMetaAllowedTypes, |
|
|
|
|
RelationTypes, |
|
|
|
|
SourceRestriction, |
|
|
|
|
substituteColumnAliasWithIdInFormula, |
|
|
|
|
substituteColumnIdWithAliasInFormula, |
|
|
|
|
UITypes, |
|
|
|
@ -197,6 +199,16 @@ export class ColumnsService {
|
|
|
|
|
Source.get(context, table.source_id), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// check if source is readonly and column type is not allowed
|
|
|
|
|
if ( |
|
|
|
|
source?.meta?.[SourceRestriction.META_READONLY] && |
|
|
|
|
(!readonlyMetaAllowedTypes.includes(column.uidt) || |
|
|
|
|
(param.column.uidt && |
|
|
|
|
!readonlyMetaAllowedTypes.includes(param.column.uidt as UITypes))) |
|
|
|
|
) { |
|
|
|
|
NcError.sourceMetaReadOnly(source.alias); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const sqlClient = await reuseOrSave('sqlClient', reuse, async () => |
|
|
|
|
NcConnectionMgrv2.getSqlClient(source), |
|
|
|
|
); |
|
|
|
@ -1482,6 +1494,14 @@ export class ColumnsService {
|
|
|
|
|
Source.get(context, table.source_id), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// check if source is readonly and column type is not allowed
|
|
|
|
|
if ( |
|
|
|
|
source?.meta?.[SourceRestriction.META_READONLY] && |
|
|
|
|
!readonlyMetaAllowedTypes.includes(param.column.uidt as UITypes) |
|
|
|
|
) { |
|
|
|
|
NcError.sourceMetaReadOnly(source.alias); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const base = await reuseOrSave('base', reuse, async () => |
|
|
|
|
source.getProject(context), |
|
|
|
|
); |
|
|
|
@ -2042,6 +2062,14 @@ export class ColumnsService {
|
|
|
|
|
Source.get(context, table.source_id, false, ncMeta), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// check if source is readonly and column type is not allowed
|
|
|
|
|
if ( |
|
|
|
|
source?.meta?.[SourceRestriction.META_READONLY] && |
|
|
|
|
!readonlyMetaAllowedTypes.includes(column.uidt) |
|
|
|
|
) { |
|
|
|
|
NcError.sourceMetaReadOnly(source.alias); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const sqlMgr = await reuseOrSave('sqlMgr', reuse, async () => |
|
|
|
|
ProjectMgrv2.getSqlMgr(context, { id: source.base_id }, ncMeta), |
|
|
|
|
); |
|
|
|
|