File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,45 @@ grant_user_{{ name }}_to_{{ bucket }}:
120120 Authorization: Token {{ influxdb[' user' ][' admin' ][' token' ] }}
121121 - onfail:
122122 - http: check_grant_user_{{ name }}_to_{{ bucket }}
123+
124+ {%- set token = ' -' .join([name, access, bucket]) -% }
125+ {%- set auth_data = {
126+ ' token' : token,
127+ ' description' : ' Grant ' ~ name ~ ' ' ~ access ~ ' access to bucket ' ~ bucket,
128+ ' orgID' : orgID,
129+ ' userID' : id ,
130+ ' permissions' : [{
131+ ' action' : ' write' if access != ' read' else ' read' ,
132+ ' resource' : [{
133+ ' id' : bucketID,
134+ ' name' : bucket,
135+ ' orgID' : orgID,
136+ ' type' : " buckets"
137+ }]
138+ }]
139+ } -% }
140+
141+ check_auth_user_{{ name }}_to_{{ bucket }}:
142+ http.query:
143+ - name: ' {{ base_url }} /private/legacy/authorizations?token={{ token }} '
144+ - status: 200
145+ - method: GET
146+ - match: ' "{{ token }} "'
147+ - match_type: string
148+ - header_dict:
149+ Authorization: Token {{ influxdb[' user' ][' admin' ][' token' ] }}
150+
151+ auth_user_{{ name }}_to_{{ bucket }}:
152+ http.query:
153+ - name: ' {{ base_url }} /private/legacy/authorizations'
154+ - status: 201
155+ - method: POST
156+ - data: ' {{ auth_data | tojson }} '
157+ - header_dict:
158+ Authorization: Token {{ influxdb[' user' ][' admin' ][' token' ] }}
159+ - onfail:
160+ - http: check_auth_user_{{ name }}_to_{{ bucket }}
161+
123162{%- endfor % }
124163{% endif % }
125164
You can’t perform that action at this time.
0 commit comments