File tree 4 files changed +31
-1
lines changed
tools/test_account_configs
4 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -591,3 +591,19 @@ def test_blueprint_split_role_user(cursor):
591
591
cursor .execute ("DROP USER IF EXISTS SPLIT_ROLE_USER" )
592
592
cursor .execute ("DROP ROLE IF EXISTS SPLIT_ROLE_A" )
593
593
cursor .execute ("DROP ROLE IF EXISTS SPLIT_ROLE_B" )
594
+
595
+
596
+ def test_blueprint_share_custom_owner (cursor , suffix ):
597
+ session = cursor .connection
598
+ share_name = f"TEST_SHARE_CUSTOM_OWNER_{ suffix } "
599
+ share = res .Share (name = share_name , owner = "TITAN_SHARE_ADMIN" )
600
+
601
+ try :
602
+ blueprint = Blueprint (resources = [share ])
603
+ plan = blueprint .plan (session )
604
+ assert len (plan ) == 1
605
+ assert isinstance (plan [0 ], CreateResource )
606
+ assert plan [0 ].urn .fqn .name == share_name
607
+ blueprint .apply (session , plan )
608
+ finally :
609
+ cursor .execute (f"DROP SHARE IF EXISTS { share_name } " )
Original file line number Diff line number Diff line change 11
11
)
12
12
from titan .enums import AccountEdition
13
13
from titan .identifiers import parse_URN
14
- from titan .privs import AccountPriv , GrantedPrivilege
15
14
from titan .resource_name import ResourceName
16
15
17
16
Original file line number Diff line number Diff line change @@ -1052,6 +1052,13 @@ def execution_strategy_for_change(
1052
1052
elif isinstance (change , CreateResource ):
1053
1053
if isinstance (change .resource_cls .scope , AccountScope ):
1054
1054
create_priv = CREATE_PRIV_FOR_RESOURCE_TYPE [change .urn .resource_type ]
1055
+
1056
+ # SHARE ownership cannot be changed
1057
+ if change .urn .resource_type == ResourceType .SHARE :
1058
+ if change_owner is None :
1059
+ raise RuntimeError
1060
+ return change_owner , False
1061
+
1055
1062
system_role = system_role_for_priv (create_priv )
1056
1063
if system_role and system_role in available_roles :
1057
1064
transfer_ownership = system_role != change_owner
Original file line number Diff line number Diff line change 78
78
comment : This role has every privilege
79
79
- name : TITAN_GRANT_ADMIN
80
80
comment : This role has MANAGE GRANTS privileges
81
+ - name : TITAN_SHARE_ADMIN
82
+ comment : This role has CREATE SHARE privilege
81
83
82
84
databases :
83
85
- name : static_database
@@ -103,6 +105,9 @@ role_grants:
103
105
- role : TITAN_GRANT_ADMIN
104
106
roles :
105
107
- SYSADMIN
108
+ - role : TITAN_SHARE_ADMIN
109
+ roles :
110
+ - SYSADMIN
106
111
107
112
# database_role_grants:
108
113
# - role: static_database_role
@@ -134,6 +139,9 @@ grants:
134
139
# TITAN_GRANT_ADMIN grants
135
140
- GRANT MANAGE GRANTS ON ACCOUNT TO ROLE TITAN_GRANT_ADMIN
136
141
142
+ # TITAN_SHARE_ADMIN grants
143
+ - GRANT CREATE SHARE ON ACCOUNT TO ROLE TITAN_SHARE_ADMIN
144
+
137
145
# CI grants
138
146
- GRANT USAGE ON WAREHOUSE STATIC_WAREHOUSE TO ROLE CI
139
147
- GRANT USAGE ON DATABASE static_database TO ROLE CI
You can’t perform that action at this time.
0 commit comments