11package trino
22
3- import data .util
4-
53# This file contains functions to determine the actual permissions
64# defined in the Trino policies for the given user and requested
75# resource.
@@ -41,7 +39,7 @@ default match_any_group(_) := false
4139
4240match_any_group (group_pattern) if {
4341 some group in groups
44- util. match_entire (group_pattern, group)
42+ match_entire (group_pattern, group)
4543}
4644
4745default match_user_group (_) := false
@@ -50,7 +48,7 @@ match_user_group(rule) if {
5048 user_pattern := object.get (rule, " user" , " .*" )
5149 group_pattern := object.get (rule, " group" , " .*" )
5250
53- util. match_entire (user_pattern, identity.user)
51+ match_entire (user_pattern, identity.user)
5452 match_any_group (group_pattern)
5553}
5654
@@ -60,7 +58,7 @@ match_original_user_group(rule) if {
6058 user_pattern := object.get (rule, " original_user" , " .*" )
6159 group_pattern := object.get (rule, " original_group" , " .*" )
6260
63- util. match_entire (user_pattern, identity.user)
61+ match_entire (user_pattern, identity.user)
6462 match_any_group (group_pattern)
6563}
6664
@@ -72,7 +70,7 @@ first_matching_authorization_rule(grantee_name) := rule if {
7270
7371 new_user_pattern := object.get (rule, " new_user" , " .*" )
7472
75- util. match_entire (new_user_pattern, grantee_name)
73+ match_entire (new_user_pattern, grantee_name)
7674 ]
7775 rule := object.union (
7876 {" allow" : true },
@@ -92,7 +90,7 @@ first_matching_catalog_rule(catalog_name) := rule if {
9290
9391 catalog_pattern := object.get (rule, " catalog" , " .*" )
9492
95- util. match_entire (catalog_pattern, catalog_name)
93+ match_entire (catalog_pattern, catalog_name)
9694 ]
9795 rule := rules[0 ]
9896}
@@ -119,8 +117,8 @@ first_matching_catalog_session_properties_rule(
119117 catalog_pattern := object.get (rule, " catalog" , " .*" )
120118 property_pattern := object.get (rule, " property" , " .*" )
121119
122- util. match_entire (catalog_pattern, catalog_name)
123- util. match_entire (property_pattern, property_name)
120+ match_entire (catalog_pattern, catalog_name)
121+ match_entire (property_pattern, property_name)
124122 ]
125123 rule := rules[0 ]
126124}
@@ -150,7 +148,7 @@ catalog_visibility(catalog_name) if {
150148
151149 catalog_pattern := object.get (rule, " catalog" , " .*" )
152150
153- util. match_entire (catalog_pattern, catalog_name)
151+ match_entire (catalog_pattern, catalog_name)
154152
155153 rule.owner == true
156154}
@@ -172,7 +170,7 @@ catalog_visibility(catalog_name) if {
172170
173171 catalog_pattern := object.get (rule, " catalog" , " .*" )
174172
175- util. match_entire (catalog_pattern, catalog_name)
173+ match_entire (catalog_pattern, catalog_name)
176174
177175 count (rule.privileges) != 0
178176}
@@ -186,7 +184,7 @@ catalog_visibility(catalog_name) if {
186184
187185 catalog_pattern := object.get (rule, " catalog" , " .*" )
188186
189- util. match_entire (catalog_pattern, catalog_name)
187+ match_entire (catalog_pattern, catalog_name)
190188
191189 rule.allow == true
192190}
@@ -205,9 +203,9 @@ first_matching_function_rule(
205203 schema_pattern := object.get (rule, " schema" , " .*" )
206204 function_pattern := object.get (rule, " function" , " .*" )
207205
208- util. match_entire (catalog_pattern, catalog_name)
209- util. match_entire (schema_pattern, schema_name)
210- util. match_entire (function_pattern, function_name)
206+ match_entire (catalog_pattern, catalog_name)
207+ match_entire (schema_pattern, schema_name)
208+ match_entire (function_pattern, function_name)
211209 ]
212210 rule := rules[0 ]
213211}
@@ -251,7 +249,7 @@ first_matching_impersonation_rule(user) := rule if {
251249 unsubstituted_new_user_pattern,
252250 )
253251
254- util. match_entire (new_user_pattern, user)
252+ match_entire (new_user_pattern, user)
255253 ]
256254 rule := object.union (
257255 {" allow" : true },
@@ -289,9 +287,9 @@ first_matching_procedure_rule(
289287 schema_pattern := object.get (rule, " schema" , " .*" )
290288 procedure_pattern := object.get (rule, " procedure" , " .*" )
291289
292- util. match_entire (catalog_pattern, catalog_name)
293- util. match_entire (schema_pattern, schema_name)
294- util. match_entire (procedure_pattern, function_name)
290+ match_entire (catalog_pattern, catalog_name)
291+ match_entire (schema_pattern, schema_name)
292+ match_entire (procedure_pattern, function_name)
295293 ]
296294 rule := rules[0 ]
297295}
@@ -331,7 +329,7 @@ first_matching_query_owned_by_rule(user) := rule if {
331329
332330 query_owner_pattern := object.get (rule, " queryOwner" , " .*" )
333331
334- util. match_entire (query_owner_pattern, user)
332+ match_entire (query_owner_pattern, user)
335333 ]
336334 rule := rules[0 ]
337335}
@@ -358,8 +356,8 @@ first_matching_schema_rule(catalog_name, schema_name) := rule if {
358356 catalog_pattern := object.get (rule, " catalog" , " .*" )
359357 schema_pattern := object.get (rule, " schema" , " .*" )
360358
361- util. match_entire (catalog_pattern, catalog_name)
362- util. match_entire (schema_pattern, schema_name)
359+ match_entire (catalog_pattern, catalog_name)
360+ match_entire (schema_pattern, schema_name)
363361 ]
364362 rule := rules[0 ]
365363}
@@ -397,8 +395,8 @@ schema_visibility(catalog_name, schema_name) if {
397395 catalog_pattern := object.get (rule, " catalog" , " .*" )
398396 schema_pattern := object.get (rule, " schema" , " .*" )
399397
400- util. match_entire (catalog_pattern, catalog_name)
401- util. match_entire (schema_pattern, schema_name)
398+ match_entire (catalog_pattern, catalog_name)
399+ match_entire (schema_pattern, schema_name)
402400
403401 count (rule.privileges) != 0
404402}
@@ -432,9 +430,9 @@ first_matching_table_rule(
432430 schema_pattern := object.get (rule, " schema" , " .*" )
433431 table_pattern := object.get (rule, " table" , " .*" )
434432
435- util. match_entire (catalog_pattern, catalog_name)
436- util. match_entire (schema_pattern, schema_name)
437- util. match_entire (table_pattern, table_name)
433+ match_entire (catalog_pattern, catalog_name)
434+ match_entire (schema_pattern, schema_name)
435+ match_entire (table_pattern, table_name)
438436 ]
439437 rule := object.union (
440438 {
@@ -545,7 +543,7 @@ first_matching_system_session_properties_rule(property_name) := rule if {
545543
546544 property_name_pattern := object.get (rule, " property" , " .*" )
547545
548- util. match_entire (property_name_pattern, property_name)
546+ match_entire (property_name_pattern, property_name)
549547 ]
550548 rule := rules[0 ]
551549}
0 commit comments