|
|
@ -5,7 +5,9 @@ import { |
|
|
|
isCreatedOrLastModifiedTimeCol, |
|
|
|
isCreatedOrLastModifiedTimeCol, |
|
|
|
isLinksOrLTAR, |
|
|
|
isLinksOrLTAR, |
|
|
|
isVirtualCol, |
|
|
|
isVirtualCol, |
|
|
|
|
|
|
|
readonlyMetaAllowedTypes, |
|
|
|
RelationTypes, |
|
|
|
RelationTypes, |
|
|
|
|
|
|
|
SourceRestriction, |
|
|
|
substituteColumnAliasWithIdInFormula, |
|
|
|
substituteColumnAliasWithIdInFormula, |
|
|
|
substituteColumnIdWithAliasInFormula, |
|
|
|
substituteColumnIdWithAliasInFormula, |
|
|
|
UITypes, |
|
|
|
UITypes, |
|
|
@ -197,6 +199,16 @@ export class ColumnsService { |
|
|
|
Source.get(context, table.source_id), |
|
|
|
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 () => |
|
|
|
const sqlClient = await reuseOrSave('sqlClient', reuse, async () => |
|
|
|
NcConnectionMgrv2.getSqlClient(source), |
|
|
|
NcConnectionMgrv2.getSqlClient(source), |
|
|
|
); |
|
|
|
); |
|
|
@ -1482,6 +1494,14 @@ export class ColumnsService { |
|
|
|
Source.get(context, table.source_id), |
|
|
|
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 () => |
|
|
|
const base = await reuseOrSave('base', reuse, async () => |
|
|
|
source.getProject(context), |
|
|
|
source.getProject(context), |
|
|
|
); |
|
|
|
); |
|
|
@ -2042,6 +2062,14 @@ export class ColumnsService { |
|
|
|
Source.get(context, table.source_id, false, ncMeta), |
|
|
|
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 () => |
|
|
|
const sqlMgr = await reuseOrSave('sqlMgr', reuse, async () => |
|
|
|
ProjectMgrv2.getSqlMgr(context, { id: source.base_id }, ncMeta), |
|
|
|
ProjectMgrv2.getSqlMgr(context, { id: source.base_id }, ncMeta), |
|
|
|
); |
|
|
|
); |
|
|
|