-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostgresql-runtime-summary-context-grants.sql
More file actions
98 lines (86 loc) · 1.9 KB
/
Copy pathpostgresql-runtime-summary-context-grants.sql
File metadata and controls
98 lines (86 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
\set ON_ERROR_STOP on
\if :{?lcm_runtime_role}
\else
\echo 'Set lcm_runtime_role to the PostgreSQL runtime role before applying summary/context grants.'
\quit 3
\endif
BEGIN;
GRANT USAGE ON SCHEMA lcm TO :"lcm_runtime_role";
-- Project-scoped operations fail closed while backend publication is unresolved.
GRANT SELECT ON TABLE lcm.fenced_leases TO :"lcm_runtime_role";
-- Summary inserts evaluate the stored generated search_document expression
-- under the runtime role. PUBLIC execution remains revoked.
GRANT EXECUTE ON FUNCTION lcm.normalize_search_text(text)
TO :"lcm_runtime_role";
GRANT SELECT ON TABLE
lcm.conversations,
lcm.messages,
lcm.summaries,
lcm.summary_messages,
lcm.summary_parents,
lcm.context_items,
lcm.large_files,
lcm.summary_large_files
TO :"lcm_runtime_role";
GRANT INSERT (
summary_id,
project_id,
conversation_id,
kind,
depth,
content,
token_count,
earliest_at,
latest_at,
descendant_count,
descendant_token_count,
source_message_token_count
)
ON TABLE lcm.summaries TO :"lcm_runtime_role";
GRANT INSERT (
project_id,
conversation_id,
summary_key,
message_id,
ordinal
)
ON TABLE lcm.summary_messages TO :"lcm_runtime_role";
GRANT INSERT (
project_id,
conversation_id,
summary_key,
parent_summary_key,
ordinal
)
ON TABLE lcm.summary_parents TO :"lcm_runtime_role";
GRANT INSERT (
project_id,
conversation_id,
summary_key,
file_id,
ordinal
)
ON TABLE lcm.summary_large_files TO :"lcm_runtime_role";
GRANT INSERT (
project_id,
conversation_id,
ordinal,
item_type,
message_id,
summary_key
),
UPDATE (ordinal)
ON TABLE lcm.context_items TO :"lcm_runtime_role";
GRANT DELETE ON TABLE lcm.context_items TO :"lcm_runtime_role";
GRANT INSERT (
file_id,
project_id,
conversation_id,
file_name,
mime_type,
byte_size,
storage_uri,
exploration_summary
)
ON TABLE lcm.large_files TO :"lcm_runtime_role";
COMMIT;