@memberjunction/core-entities 6.2.0-edge.7 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/custom/AnchoredConversationSecurity.d.ts +103 -0
- package/dist/custom/AnchoredConversationSecurity.d.ts.map +1 -0
- package/dist/custom/AnchoredConversationSecurity.js +401 -0
- package/dist/custom/AnchoredConversationSecurity.js.map +1 -0
- package/dist/custom/ConversationWriteAccess.d.ts +11 -3
- package/dist/custom/ConversationWriteAccess.d.ts.map +1 -1
- package/dist/custom/ConversationWriteAccess.js +100 -9
- package/dist/custom/ConversationWriteAccess.js.map +1 -1
- package/dist/custom/MJConversationDetailEntityExtended.d.ts.map +1 -1
- package/dist/custom/MJConversationDetailEntityExtended.js +18 -1
- package/dist/custom/MJConversationDetailEntityExtended.js.map +1 -1
- package/dist/custom/MJProjectEntityExtended.d.ts +12 -0
- package/dist/custom/MJProjectEntityExtended.d.ts.map +1 -0
- package/dist/custom/MJProjectEntityExtended.js +35 -0
- package/dist/custom/MJProjectEntityExtended.js.map +1 -0
- package/dist/custom/Permissions/index.d.ts +1 -0
- package/dist/custom/Permissions/index.d.ts.map +1 -1
- package/dist/custom/Permissions/index.js +1 -0
- package/dist/custom/Permissions/index.js.map +1 -1
- package/dist/custom/Permissions/mentionNotification.d.ts +64 -0
- package/dist/custom/Permissions/mentionNotification.d.ts.map +1 -0
- package/dist/custom/Permissions/mentionNotification.js +315 -0
- package/dist/custom/Permissions/mentionNotification.js.map +1 -0
- package/dist/custom/ResourcePermissions/MJResourcePermissionEntityExtended.d.ts.map +1 -1
- package/dist/custom/ResourcePermissions/MJResourcePermissionEntityExtended.js +12 -4
- package/dist/custom/ResourcePermissions/MJResourcePermissionEntityExtended.js.map +1 -1
- package/dist/custom/ResourcePermissions/ResourcePermissionEngine.d.ts.map +1 -1
- package/dist/custom/ResourcePermissions/ResourcePermissionEngine.js +9 -1
- package/dist/custom/ResourcePermissions/ResourcePermissionEngine.js.map +1 -1
- package/dist/engines/conversations.d.ts +294 -13
- package/dist/engines/conversations.d.ts.map +1 -1
- package/dist/engines/conversations.js +838 -40
- package/dist/engines/conversations.js.map +1 -1
- package/dist/generated/entities/__mj.d.ts +8364 -5414
- package/dist/generated/entities/__mj.d.ts.map +1 -1
- package/dist/generated/entities/__mj.js +12500 -8546
- package/dist/generated/entities/__mj.js.map +1 -1
- package/dist/generated/remote_operations.d.ts +294 -0
- package/dist/generated/remote_operations.d.ts.map +1 -1
- package/dist/generated/remote_operations.js +207 -0
- package/dist/generated/remote_operations.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { EntityInfo, IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
2
|
+
import type { MJConversationEntity, MJConversationEntity_IConversationAnchorMetadata } from '../generated/entity_subclasses.js';
|
|
3
|
+
/**
|
|
4
|
+
* Union of allowed `AnchorType` values on `MJ: Conversations`, derived directly
|
|
5
|
+
* from the CodeGen-generated entity property so CHECK constraint changes flow through automatically.
|
|
6
|
+
*/
|
|
7
|
+
export type ConversationAnchorType = NonNullable<MJConversationEntity['AnchorType']>;
|
|
8
|
+
/**
|
|
9
|
+
* Strongly-typed JSON payload for `MJ: Conversations.AnchorMetadata` (`AnchorMetadataObject`),
|
|
10
|
+
* derived from the CodeGen-generated interface.
|
|
11
|
+
*/
|
|
12
|
+
export type ConversationAnchorMetadata = MJConversationEntity_IConversationAnchorMetadata;
|
|
13
|
+
/**
|
|
14
|
+
* Result of checking whether a user may read the record to which a conversation is anchored.
|
|
15
|
+
*/
|
|
16
|
+
export interface LinkedRecordReadDecision {
|
|
17
|
+
/** Whether the user is allowed to read the linked record. */
|
|
18
|
+
Allowed: boolean;
|
|
19
|
+
/** Human-readable denial reason when `Allowed === false`, or `null` when allowed. */
|
|
20
|
+
Reason: string | null;
|
|
21
|
+
/** Resolved `EntityInfo` for `linkedEntityId`, or `null` if the entity was not found. */
|
|
22
|
+
EntityInfo: EntityInfo | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Minimal structural shape required to evaluate RLS and FLS visibility on an anchored conversation.
|
|
26
|
+
* Satisfied by full `MJConversationEntity` instances as well as `ResultType: 'simple'` projection rows.
|
|
27
|
+
*/
|
|
28
|
+
export interface AnchoredConversationCandidate {
|
|
29
|
+
ID?: string;
|
|
30
|
+
LinkedEntityID?: string | null;
|
|
31
|
+
LinkedRecordID?: string | null;
|
|
32
|
+
AnchorType?: MJConversationEntity['AnchorType'];
|
|
33
|
+
AnchorKey?: string | null;
|
|
34
|
+
AnchorMetadata?: string | null;
|
|
35
|
+
AnchorMetadataObject?: MJConversationEntity_IConversationAnchorMetadata | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Safely parses `AnchorMetadata` from either an already-parsed object or a raw JSON string.
|
|
39
|
+
* Returns `null` when empty or malformed.
|
|
40
|
+
*/
|
|
41
|
+
export declare function ParseConversationAnchorMetadata(raw: MJConversationEntity_IConversationAnchorMetadata | string | null | undefined): MJConversationEntity_IConversationAnchorMetadata | null;
|
|
42
|
+
/**
|
|
43
|
+
* Deterministic Field-Level Security (FLS) gate for anchored conversations.
|
|
44
|
+
*
|
|
45
|
+
* Returns `true` when the conversation must be hidden from `user` because:
|
|
46
|
+
* 1. `entityInfo.FieldLevelSecurityApplies` is `true`, AND
|
|
47
|
+
* 2. Either:
|
|
48
|
+
* - `anchorType === 'Field'` and `anchorKey` is in `entityInfo.GetDeniedReadFields(user)`, OR
|
|
49
|
+
* - `anchorMetadata.fieldName` is in `entityInfo.GetDeniedReadFields(user)`, OR
|
|
50
|
+
* - Any field listed in `anchorMetadata.restrictedFields` is in `entityInfo.GetDeniedReadFields(user)`.
|
|
51
|
+
*
|
|
52
|
+
* Runs in O(1) memory with zero database or LLM calls on the read path.
|
|
53
|
+
*/
|
|
54
|
+
export declare function IsConversationHiddenByFieldSecurity(entityInfo: EntityInfo | null | undefined, user: UserInfo | null | undefined, anchorType: MJConversationEntity['AnchorType'], anchorKey: string | null | undefined, anchorMetadata: MJConversationEntity_IConversationAnchorMetadata | string | null | undefined): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Builds a SQL `WHERE` filter expression matching `linkedRecordId` against `entityInfo`'s primary key(s).
|
|
57
|
+
* Supports both plain scalar PK strings (`'81D4BC3D-...'` or `'42'`) and `CompositeKey.ToURLSegment()`
|
|
58
|
+
* formatted strings (`'ID|81D4BC3D-...'` or `'Key1|Val1||Key2|Val2'`).
|
|
59
|
+
* Uses `provider.QuoteIdentifier` when available so filters work across both SQL Server (`[ID]`) and PostgreSQL (`"ID"`).
|
|
60
|
+
*/
|
|
61
|
+
export declare function BuildLinkedRecordPrimaryKeyFilter(entityInfo: EntityInfo, linkedRecordId: string, provider?: IMetadataProvider | null): string | null;
|
|
62
|
+
/**
|
|
63
|
+
* Verifies whether `user` can read the record identified by `(linkedEntityId, linkedRecordId)`.
|
|
64
|
+
*
|
|
65
|
+
* Checks:
|
|
66
|
+
* 1. The target entity exists in `provider.Entities`.
|
|
67
|
+
* 2. `user` holds entity-level `CanRead` permission on the target entity (`EntityInfo.GetUserPermisions(user)`).
|
|
68
|
+
* 3. On the server (`provider.ProviderType === 'Database'`), executes a 1-row `RunView` scoped to `user`
|
|
69
|
+
* so any Row-Level Security (`MJ: Entity Row Filters`) predicate is enforced at the database level.
|
|
70
|
+
*/
|
|
71
|
+
export declare function UserCanReadLinkedRecord(provider: IMetadataProvider, user: UserInfo | null | undefined, linkedEntityId: string | null | undefined, linkedRecordId: string | null | undefined): Promise<LinkedRecordReadDecision>;
|
|
72
|
+
/**
|
|
73
|
+
* Filters a list of anchored conversations (or simple rows) for `user`, removing any thread where:
|
|
74
|
+
* - `user` is denied read access to the linked record via entity permissions or Row-Level Security (RLS), OR
|
|
75
|
+
* - `user` is denied read access to the anchored field or any field in `AnchorMetadata.restrictedFields` (FLS).
|
|
76
|
+
*
|
|
77
|
+
* Deduplicates `(LinkedEntityID, LinkedRecordID)` checks so N comment threads on the same record
|
|
78
|
+
* require at most one RLS check.
|
|
79
|
+
*/
|
|
80
|
+
export declare function FilterAnchoredConversationsForUser<T extends AnchoredConversationCandidate>(provider: IMetadataProvider, user: UserInfo | null | undefined, conversations: readonly T[]): Promise<T[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Deterministic Stage 1 detector for FLS-governed fields referenced by a comment.
|
|
83
|
+
*
|
|
84
|
+
* Runs only when `entityInfo.FieldLevelSecurityApplies` is `true`. Checks:
|
|
85
|
+
* 1. Whether `anchorType === 'Field'` and `anchorKey` names an FLS-governed field (`f.HasFieldPermissions`).
|
|
86
|
+
* 2. Whether `messageText` mentions an FLS-governed field's code `Name` (exact or camelCase-split words)
|
|
87
|
+
* or `DisplayName` (case-insensitive word-boundary match).
|
|
88
|
+
* 3. Whether `recordValues` is provided and `messageText` contains the linked record's actual non-trivial
|
|
89
|
+
* value (or formatted number) for an FLS-governed field (for example, commenting `"$185,000 is too high"`
|
|
90
|
+
* at the Record level when the restricted `Salary` field on that record has value `185000`).
|
|
91
|
+
*
|
|
92
|
+
* Returns the deduplicated array of canonical `EntityFieldInfo.Name` strings for matched FLS fields.
|
|
93
|
+
*/
|
|
94
|
+
export declare function DetectReferencedRestrictedFieldsDeterministic(entityInfo: EntityInfo | null | undefined, messageText: string | null | undefined, anchorType: MJConversationEntity['AnchorType'], anchorKey: string | null | undefined, recordValues?: Readonly<Record<string, unknown>> | null): string[];
|
|
95
|
+
/**
|
|
96
|
+
* Merges newly-detected restricted field names into an existing `IConversationAnchorMetadata` object,
|
|
97
|
+
* returning the updated metadata object and a boolean indicating whether any new field was added.
|
|
98
|
+
*/
|
|
99
|
+
export declare function MergeRestrictedFieldsIntoAnchorMetadata(existing: MJConversationEntity_IConversationAnchorMetadata | null | undefined, newlyDetectedFieldNames: readonly string[]): {
|
|
100
|
+
Metadata: MJConversationEntity_IConversationAnchorMetadata;
|
|
101
|
+
Changed: boolean;
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=AnchoredConversationSecurity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchoredConversationSecurity.d.ts","sourceRoot":"","sources":["../../src/custom/AnchoredConversationSecurity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,UAAU,EAAE,iBAAiB,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEpJ,OAAO,KAAK,EACR,oBAAoB,EACpB,gDAAgD,EACnD,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,gDAAgD,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,6DAA6D;IAC7D,OAAO,EAAE,OAAO,CAAC;IACjB,qFAAqF;IACrF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yFAAyF;IACzF,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,oBAAoB,CAAC,EAAE,gDAAgD,GAAG,IAAI,CAAC;CAClF;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC3C,GAAG,E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AY,CAAC,EAC9C,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GACxD,MAAM,EAAE,CAkDV;AAoDD;;;GAGG;AACH,wBAAgB,uCAAuC,CACnD,QAAQ,EAAE,gDAAgD,GAAG,IAAI,GAAG,SAAS,EAC7E,uBAAuB,EAAE,SAAS,MAAM,EAAE,GAC3C;IAAE,QAAQ,EAAE,gDAAgD,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAwBlF"}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { CompositeKey, EntityFieldTSType, LogError, RunView } from '@memberjunction/core';
|
|
2
|
+
import { EscapeSQLString, UUIDsEqual } from '@memberjunction/global';
|
|
3
|
+
/**
|
|
4
|
+
* Safely parses `AnchorMetadata` from either an already-parsed object or a raw JSON string.
|
|
5
|
+
* Returns `null` when empty or malformed.
|
|
6
|
+
*/
|
|
7
|
+
export function ParseConversationAnchorMetadata(raw) {
|
|
8
|
+
if (!raw) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (typeof raw === 'object') {
|
|
12
|
+
return raw;
|
|
13
|
+
}
|
|
14
|
+
if (typeof raw === 'string') {
|
|
15
|
+
const trimmed = raw.trim();
|
|
16
|
+
if (!trimmed) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const parsed = JSON.parse(trimmed);
|
|
21
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
22
|
+
return parsed;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Deterministic Field-Level Security (FLS) gate for anchored conversations.
|
|
33
|
+
*
|
|
34
|
+
* Returns `true` when the conversation must be hidden from `user` because:
|
|
35
|
+
* 1. `entityInfo.FieldLevelSecurityApplies` is `true`, AND
|
|
36
|
+
* 2. Either:
|
|
37
|
+
* - `anchorType === 'Field'` and `anchorKey` is in `entityInfo.GetDeniedReadFields(user)`, OR
|
|
38
|
+
* - `anchorMetadata.fieldName` is in `entityInfo.GetDeniedReadFields(user)`, OR
|
|
39
|
+
* - Any field listed in `anchorMetadata.restrictedFields` is in `entityInfo.GetDeniedReadFields(user)`.
|
|
40
|
+
*
|
|
41
|
+
* Runs in O(1) memory with zero database or LLM calls on the read path.
|
|
42
|
+
*/
|
|
43
|
+
export function IsConversationHiddenByFieldSecurity(entityInfo, user, anchorType, anchorKey, anchorMetadata) {
|
|
44
|
+
if (!entityInfo || !user) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
// fls-guard: filter anchored conversations referencing restricted fields
|
|
48
|
+
if (!entityInfo.FieldLevelSecurityApplies) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const denied = entityInfo.GetDeniedReadFields(user);
|
|
52
|
+
if (denied.size === 0) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (anchorType === 'Field' && anchorKey) {
|
|
56
|
+
const normalizedKey = anchorKey.trim().toLowerCase();
|
|
57
|
+
if (normalizedKey.length > 0 && denied.has(normalizedKey)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const metadata = ParseConversationAnchorMetadata(anchorMetadata);
|
|
62
|
+
if (!metadata) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if (typeof metadata.fieldName === 'string' && metadata.fieldName.trim().length > 0) {
|
|
66
|
+
if (denied.has(metadata.fieldName.trim().toLowerCase())) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(metadata.restrictedFields)) {
|
|
71
|
+
for (const fieldName of metadata.restrictedFields) {
|
|
72
|
+
if (typeof fieldName === 'string' && fieldName.trim().length > 0) {
|
|
73
|
+
if (denied.has(fieldName.trim().toLowerCase())) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Builds a SQL `WHERE` filter expression matching `linkedRecordId` against `entityInfo`'s primary key(s).
|
|
83
|
+
* Supports both plain scalar PK strings (`'81D4BC3D-...'` or `'42'`) and `CompositeKey.ToURLSegment()`
|
|
84
|
+
* formatted strings (`'ID|81D4BC3D-...'` or `'Key1|Val1||Key2|Val2'`).
|
|
85
|
+
* Uses `provider.QuoteIdentifier` when available so filters work across both SQL Server (`[ID]`) and PostgreSQL (`"ID"`).
|
|
86
|
+
*/
|
|
87
|
+
export function BuildLinkedRecordPrimaryKeyFilter(entityInfo, linkedRecordId, provider) {
|
|
88
|
+
const raw = (linkedRecordId ?? '').trim();
|
|
89
|
+
if (!raw || entityInfo.PrimaryKeys.length === 0) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const pkFieldsByLower = new Map();
|
|
93
|
+
for (const pk of entityInfo.PrimaryKeys) {
|
|
94
|
+
pkFieldsByLower.set(pk.Name.toLowerCase(), pk);
|
|
95
|
+
}
|
|
96
|
+
// Check if the string is in CompositeKey URL segment format (e.g., "ID|123" or "A|1||B|2")
|
|
97
|
+
if (raw.includes('|')) {
|
|
98
|
+
const ck = CompositeKey.FromURLSegment(entityInfo, raw);
|
|
99
|
+
if (ck.KeyValuePairs.length > 0) {
|
|
100
|
+
const clauses = [];
|
|
101
|
+
for (const kv of ck.KeyValuePairs) {
|
|
102
|
+
const field = pkFieldsByLower.get((kv.FieldName ?? '').trim().toLowerCase());
|
|
103
|
+
if (!field) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const clause = formatSinglePrimaryKeyClause(field, String(kv.Value ?? ''), provider);
|
|
107
|
+
if (!clause) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
clauses.push(clause);
|
|
111
|
+
}
|
|
112
|
+
if (clauses.length === entityInfo.PrimaryKeys.length) {
|
|
113
|
+
return clauses.join(' AND ');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Single primary key plain value
|
|
118
|
+
if (entityInfo.PrimaryKeys.length === 1) {
|
|
119
|
+
return formatSinglePrimaryKeyClause(entityInfo.FirstPrimaryKey, raw, provider); // first-pk-ok: guarded by entityInfo.PrimaryKeys.length === 1
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
function formatSinglePrimaryKeyClause(field, rawValue, provider) {
|
|
124
|
+
const trimmed = rawValue.trim();
|
|
125
|
+
if (!trimmed) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const quotable = provider;
|
|
129
|
+
const quotedCol = typeof quotable?.QuoteIdentifier === 'function'
|
|
130
|
+
? quotable.QuoteIdentifier(field.Name)
|
|
131
|
+
: `[${field.Name}]`;
|
|
132
|
+
const isPostgresQuoted = quotedCol.startsWith('"');
|
|
133
|
+
if (field.TSType === EntityFieldTSType.Number) {
|
|
134
|
+
const num = Number(trimmed);
|
|
135
|
+
if (!Number.isFinite(num)) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
return `${quotedCol}=${num}`;
|
|
139
|
+
}
|
|
140
|
+
const stringPrefix = isPostgresQuoted ? '' : 'N';
|
|
141
|
+
return `${quotedCol}=${stringPrefix}'${EscapeSQLString(trimmed)}'`;
|
|
142
|
+
}
|
|
143
|
+
function resolveEntityInfoById(provider, entityId) {
|
|
144
|
+
if (!provider || !entityId) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
if (typeof provider.EntityByID === 'function') {
|
|
148
|
+
const found = provider.EntityByID(entityId);
|
|
149
|
+
if (found) {
|
|
150
|
+
return found;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return provider.Entities?.find((e) => UUIDsEqual(e.ID, entityId)) ?? null;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Verifies whether `user` can read the record identified by `(linkedEntityId, linkedRecordId)`.
|
|
157
|
+
*
|
|
158
|
+
* Checks:
|
|
159
|
+
* 1. The target entity exists in `provider.Entities`.
|
|
160
|
+
* 2. `user` holds entity-level `CanRead` permission on the target entity (`EntityInfo.GetUserPermisions(user)`).
|
|
161
|
+
* 3. On the server (`provider.ProviderType === 'Database'`), executes a 1-row `RunView` scoped to `user`
|
|
162
|
+
* so any Row-Level Security (`MJ: Entity Row Filters`) predicate is enforced at the database level.
|
|
163
|
+
*/
|
|
164
|
+
export async function UserCanReadLinkedRecord(provider, user, linkedEntityId, linkedRecordId) {
|
|
165
|
+
if (!linkedEntityId || !linkedRecordId) {
|
|
166
|
+
return { Allowed: false, Reason: 'Linked entity and record ID are required.', EntityInfo: null };
|
|
167
|
+
}
|
|
168
|
+
if (!user) {
|
|
169
|
+
return { Allowed: false, Reason: 'User context is required.', EntityInfo: null };
|
|
170
|
+
}
|
|
171
|
+
const entityInfo = resolveEntityInfoById(provider, linkedEntityId);
|
|
172
|
+
if (!entityInfo) {
|
|
173
|
+
return { Allowed: false, Reason: 'Linked entity was not found.', EntityInfo: null };
|
|
174
|
+
}
|
|
175
|
+
const perms = entityInfo.GetUserPermisions(user);
|
|
176
|
+
if (!perms?.CanRead) {
|
|
177
|
+
return {
|
|
178
|
+
Allowed: false,
|
|
179
|
+
Reason: `You do not have permission to read ${entityInfo.DisplayNameOrName} records.`,
|
|
180
|
+
EntityInfo: entityInfo
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (provider?.ProviderType !== 'Database') {
|
|
184
|
+
return { Allowed: true, Reason: null, EntityInfo: entityInfo };
|
|
185
|
+
}
|
|
186
|
+
const pkFilter = BuildLinkedRecordPrimaryKeyFilter(entityInfo, linkedRecordId, provider);
|
|
187
|
+
if (!pkFilter) {
|
|
188
|
+
return {
|
|
189
|
+
Allowed: false,
|
|
190
|
+
Reason: 'Invalid linked record identifier.',
|
|
191
|
+
EntityInfo: entityInfo
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const rv = RunView.FromMetadataProvider(provider);
|
|
196
|
+
const pkFieldNames = entityInfo.PrimaryKeys.map((pk) => pk.Name);
|
|
197
|
+
const result = await rv.RunView({
|
|
198
|
+
EntityName: entityInfo.Name,
|
|
199
|
+
ExtraFilter: pkFilter,
|
|
200
|
+
Fields: pkFieldNames,
|
|
201
|
+
MaxRows: 1,
|
|
202
|
+
ResultType: 'simple'
|
|
203
|
+
}, user);
|
|
204
|
+
if (!result.Success) {
|
|
205
|
+
LogError(`UserCanReadLinkedRecord: RunView failed on ${entityInfo.Name}: ${result.ErrorMessage}`);
|
|
206
|
+
return {
|
|
207
|
+
Allowed: false,
|
|
208
|
+
Reason: 'Unable to verify access to the linked record.',
|
|
209
|
+
EntityInfo: entityInfo
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
if ((result.Results?.length ?? 0) === 0) {
|
|
213
|
+
return {
|
|
214
|
+
Allowed: false,
|
|
215
|
+
Reason: 'You do not have access to the linked record.',
|
|
216
|
+
EntityInfo: entityInfo
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return { Allowed: true, Reason: null, EntityInfo: entityInfo };
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
LogError(`UserCanReadLinkedRecord: unexpected error on ${entityInfo.Name} (${linkedRecordId}): ${error instanceof Error ? error.message : String(error)}`);
|
|
223
|
+
return {
|
|
224
|
+
Allowed: false,
|
|
225
|
+
Reason: 'Unable to verify access to the linked record.',
|
|
226
|
+
EntityInfo: entityInfo
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Filters a list of anchored conversations (or simple rows) for `user`, removing any thread where:
|
|
232
|
+
* - `user` is denied read access to the linked record via entity permissions or Row-Level Security (RLS), OR
|
|
233
|
+
* - `user` is denied read access to the anchored field or any field in `AnchorMetadata.restrictedFields` (FLS).
|
|
234
|
+
*
|
|
235
|
+
* Deduplicates `(LinkedEntityID, LinkedRecordID)` checks so N comment threads on the same record
|
|
236
|
+
* require at most one RLS check.
|
|
237
|
+
*/
|
|
238
|
+
export async function FilterAnchoredConversationsForUser(provider, user, conversations) {
|
|
239
|
+
if (!user || conversations.length === 0) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
const rlsCache = new Map();
|
|
243
|
+
const checkRecordAccess = (entityId, recordId) => {
|
|
244
|
+
const cacheKey = `${entityId.trim().toLowerCase()}::${recordId.trim()}`;
|
|
245
|
+
let pending = rlsCache.get(cacheKey);
|
|
246
|
+
if (!pending) {
|
|
247
|
+
pending = UserCanReadLinkedRecord(provider, user, entityId, recordId);
|
|
248
|
+
rlsCache.set(cacheKey, pending);
|
|
249
|
+
}
|
|
250
|
+
return pending;
|
|
251
|
+
};
|
|
252
|
+
const visible = [];
|
|
253
|
+
for (const conv of conversations) {
|
|
254
|
+
const linkedEntityId = conv.LinkedEntityID;
|
|
255
|
+
const linkedRecordId = conv.LinkedRecordID;
|
|
256
|
+
if (!linkedEntityId || !linkedRecordId) {
|
|
257
|
+
visible.push(conv);
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const recordAccess = await checkRecordAccess(linkedEntityId, linkedRecordId);
|
|
261
|
+
if (!recordAccess.Allowed || !recordAccess.EntityInfo) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const metadata = conv.AnchorMetadataObject ?? conv.AnchorMetadata ?? null;
|
|
265
|
+
if (IsConversationHiddenByFieldSecurity(recordAccess.EntityInfo, user, conv.AnchorType ?? null, conv.AnchorKey ?? null, metadata)) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
visible.push(conv);
|
|
269
|
+
}
|
|
270
|
+
return visible;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Deterministic Stage 1 detector for FLS-governed fields referenced by a comment.
|
|
274
|
+
*
|
|
275
|
+
* Runs only when `entityInfo.FieldLevelSecurityApplies` is `true`. Checks:
|
|
276
|
+
* 1. Whether `anchorType === 'Field'` and `anchorKey` names an FLS-governed field (`f.HasFieldPermissions`).
|
|
277
|
+
* 2. Whether `messageText` mentions an FLS-governed field's code `Name` (exact or camelCase-split words)
|
|
278
|
+
* or `DisplayName` (case-insensitive word-boundary match).
|
|
279
|
+
* 3. Whether `recordValues` is provided and `messageText` contains the linked record's actual non-trivial
|
|
280
|
+
* value (or formatted number) for an FLS-governed field (for example, commenting `"$185,000 is too high"`
|
|
281
|
+
* at the Record level when the restricted `Salary` field on that record has value `185000`).
|
|
282
|
+
*
|
|
283
|
+
* Returns the deduplicated array of canonical `EntityFieldInfo.Name` strings for matched FLS fields.
|
|
284
|
+
*/
|
|
285
|
+
export function DetectReferencedRestrictedFieldsDeterministic(entityInfo, messageText, anchorType, anchorKey, recordValues) {
|
|
286
|
+
if (!entityInfo || !entityInfo.FieldLevelSecurityApplies) {
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
const restrictedFields = entityInfo.Fields.filter((f) => f.HasFieldPermissions);
|
|
290
|
+
if (restrictedFields.length === 0) {
|
|
291
|
+
return [];
|
|
292
|
+
}
|
|
293
|
+
const matched = new Set();
|
|
294
|
+
// 1. Direct field anchor on an FLS-governed field
|
|
295
|
+
if (anchorType === 'Field' && anchorKey) {
|
|
296
|
+
const targetLower = anchorKey.trim().toLowerCase();
|
|
297
|
+
const directField = restrictedFields.find((f) => f.Name.toLowerCase() === targetLower);
|
|
298
|
+
if (directField) {
|
|
299
|
+
matched.add(directField.Name);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const text = (messageText ?? '').trim();
|
|
303
|
+
if (!text) {
|
|
304
|
+
return [...matched];
|
|
305
|
+
}
|
|
306
|
+
const textLower = text.toLowerCase();
|
|
307
|
+
for (const field of restrictedFields) {
|
|
308
|
+
if (matched.has(field.Name)) {
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
// 2. Match field Name, camelCase-spaced Name, or DisplayName on word boundaries
|
|
312
|
+
const candidateLabels = buildFieldCandidatePhrases(field);
|
|
313
|
+
if (candidateLabels.some((phrase) => containsWholePhrase(textLower, phrase))) {
|
|
314
|
+
matched.add(field.Name);
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
// 3. Match actual restricted field value from the record when non-trivial
|
|
318
|
+
if (recordValues && Object.prototype.hasOwnProperty.call(recordValues, field.Name)) {
|
|
319
|
+
const rawVal = recordValues[field.Name];
|
|
320
|
+
const valueCandidates = buildRestrictedValueCandidates(rawVal);
|
|
321
|
+
if (valueCandidates.some((valLower) => textLower.includes(valLower))) {
|
|
322
|
+
matched.add(field.Name);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return [...matched];
|
|
327
|
+
}
|
|
328
|
+
function buildFieldCandidatePhrases(field) {
|
|
329
|
+
const phrases = new Set();
|
|
330
|
+
const rawName = field.Name.trim();
|
|
331
|
+
if (rawName.length >= 3) {
|
|
332
|
+
phrases.add(rawName.toLowerCase());
|
|
333
|
+
const spaced = rawName
|
|
334
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
335
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
|
336
|
+
.replace(/_/g, ' ')
|
|
337
|
+
.trim()
|
|
338
|
+
.toLowerCase();
|
|
339
|
+
if (spaced.length >= 3) {
|
|
340
|
+
phrases.add(spaced);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const displayName = (field.DisplayName ?? '').trim().toLowerCase();
|
|
344
|
+
if (displayName.length >= 3) {
|
|
345
|
+
phrases.add(displayName);
|
|
346
|
+
}
|
|
347
|
+
return [...phrases];
|
|
348
|
+
}
|
|
349
|
+
function containsWholePhrase(haystackLower, phraseLower) {
|
|
350
|
+
const escaped = phraseLower.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
351
|
+
const regex = new RegExp(`(?:^|[^a-z0-9])${escaped}(?:$|[^a-z0-9])`, 'i');
|
|
352
|
+
return regex.test(haystackLower);
|
|
353
|
+
}
|
|
354
|
+
function buildRestrictedValueCandidates(rawVal) {
|
|
355
|
+
if (rawVal === null || rawVal === undefined || typeof rawVal === 'boolean') {
|
|
356
|
+
return [];
|
|
357
|
+
}
|
|
358
|
+
if (typeof rawVal === 'number') {
|
|
359
|
+
if (!Number.isFinite(rawVal) || Math.abs(rawVal) < 100) {
|
|
360
|
+
return [];
|
|
361
|
+
}
|
|
362
|
+
const plain = String(rawVal).toLowerCase();
|
|
363
|
+
const formatted = rawVal.toLocaleString('en-US').toLowerCase();
|
|
364
|
+
return formatted !== plain ? [plain, formatted] : [plain];
|
|
365
|
+
}
|
|
366
|
+
if (typeof rawVal === 'string') {
|
|
367
|
+
const trimmed = rawVal.trim().toLowerCase();
|
|
368
|
+
if (trimmed.length < 4 || trimmed === 'true' || trimmed === 'false' || trimmed === 'null') {
|
|
369
|
+
return [];
|
|
370
|
+
}
|
|
371
|
+
return [trimmed];
|
|
372
|
+
}
|
|
373
|
+
return [];
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Merges newly-detected restricted field names into an existing `IConversationAnchorMetadata` object,
|
|
377
|
+
* returning the updated metadata object and a boolean indicating whether any new field was added.
|
|
378
|
+
*/
|
|
379
|
+
export function MergeRestrictedFieldsIntoAnchorMetadata(existing, newlyDetectedFieldNames) {
|
|
380
|
+
const base = existing ? { ...existing } : {};
|
|
381
|
+
const currentList = Array.isArray(base.restrictedFields) ? [...base.restrictedFields] : [];
|
|
382
|
+
const seenLower = new Set(currentList.map((f) => f.trim().toLowerCase()));
|
|
383
|
+
let changed = false;
|
|
384
|
+
for (const fieldName of newlyDetectedFieldNames) {
|
|
385
|
+
const trimmed = fieldName.trim();
|
|
386
|
+
if (!trimmed) {
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
const lower = trimmed.toLowerCase();
|
|
390
|
+
if (!seenLower.has(lower)) {
|
|
391
|
+
seenLower.add(lower);
|
|
392
|
+
currentList.push(trimmed);
|
|
393
|
+
changed = true;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (currentList.length > 0) {
|
|
397
|
+
base.restrictedFields = currentList;
|
|
398
|
+
}
|
|
399
|
+
return { Metadata: base, Changed: changed };
|
|
400
|
+
}
|
|
401
|
+
//# sourceMappingURL=AnchoredConversationSecurity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchoredConversationSecurity.js","sourceRoot":"","sources":["../../src/custom/AnchoredConversationSecurity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,iBAAiB,EAAiC,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AACpJ,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA4CrE;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAC3C,GAAiF;IAEjF,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACf,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,CAAC;YACD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC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CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3F,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAE1E,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,SAAS,IAAI,uBAAuB,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,SAAS;QACb,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACrB,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1B,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;IACL,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,WAAW,CAAC;IACxC,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -13,9 +13,17 @@ export interface ConversationWriteDecision {
|
|
|
13
13
|
Loaded: boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Whether a user may write rows that belong to a conversation:
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Whether a user may write rows that belong to a conversation:
|
|
17
|
+
* - For anchored record/artifact comment threads (`AnchorType != null` with `LinkedEntityID` and `LinkedRecordID`),
|
|
18
|
+
* any user who can read the linked record (including RLS) and is not denied read access on the anchored field
|
|
19
|
+
* or `restrictedFields` (FLS) may post and reply in the thread.
|
|
20
|
+
* - For standard chat conversations (`AnchorType == null`), the conversation owner, a user with an
|
|
21
|
+
* explicit `Edit`/`Owner` grant on the conversation, or (when {@link IsInheritingFolderAccess}
|
|
22
|
+
* is true) a user with an `Edit`/`Owner` grant on the conversation's folder (`MJ: Projects`).
|
|
23
|
+
* Conversations inside a Public folder (`Project.OwnerUserID IS NULL`) or a Shared folder with
|
|
24
|
+
* `View` access grant View-only access unless an explicit `Edit`/`Owner` grant says otherwise.
|
|
25
|
+
*
|
|
26
|
+
* Server-side only; a non-database provider trusts the enforcement that already ran upstream.
|
|
19
27
|
*/
|
|
20
28
|
export declare function UserMayWriteConversation(provider: IMetadataProvider, user: UserInfo | null | undefined, conversationId: string): Promise<ConversationWriteDecision>;
|
|
21
29
|
//# sourceMappingURL=ConversationWriteAccess.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationWriteAccess.d.ts","sourceRoot":"","sources":["../../src/custom/ConversationWriteAccess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConversationWriteAccess.d.ts","sourceRoot":"","sources":["../../src/custom/ConversationWriteAccess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMnE,4EAA4E;AAC5E,eAAO,MAAM,8BAA8B,yCAAyC,CAAC;AAwBrF,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wEAAwE;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,wBAAwB,CAC1C,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,EACjC,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC,yBAAyB,CAAC,CA4GpC"}
|