doc-exports/docs/dli/api-ref/dli_02_0039.html
Su, Xiaomeng 2374069890 DLI API 20230215 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2023-03-22 08:50:34 +00:00

211 lines
17 KiB
HTML

<a name="dli_02_0039"></a><a name="dli_02_0039"></a>
<h1 class="topictitle1">Granting Data Permission to Users</h1>
<div id="body8662426"><div class="section" id="dli_02_0039__se8490992842549b6a3c256bc5e018bc7"><h4 class="sectiontitle">Function</h4><p id="dli_02_0039__en-us_topic_0069077916_p19372314">This API is used to grant database or table data usage permission to specified users.</p>
</div>
<div class="section" id="dli_02_0039__sed20525659cf4b48837c283af3e523bd"><h4 class="sectiontitle">URI</h4><ul id="dli_02_0039__en-us_topic_0069077916_ul25653620"><li id="dli_02_0039__en-us_topic_0069077916_li29555991">URI format<p id="dli_02_0039__en-us_topic_0069077916_p64677330"><a name="dli_02_0039__en-us_topic_0069077916_li29555991"></a><a name="en-us_topic_0069077916_li29555991"></a>PUT /v1.0/{project_id}/user-authorization</p>
</li><li id="dli_02_0039__li1725612218454">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0039__en-us_topic_0069077803_table60779388" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameter</caption><thead align="left"><tr id="dli_02_0039__en-us_topic_0069077803_row61411666"><th align="left" class="cellrowborder" valign="top" width="12%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="dli_02_0039__a420a62a594f9410eaea229ffc8037a61">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.64%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="dli_02_0039__en-us_topic_0069077803_p873025824211">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.709999999999999%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="dli_02_0039__p10881623151215">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="64.64999999999999%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="dli_02_0039__a692d3cd97b464aed90ba6d841900a4a5">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0039__en-us_topic_0069077803_row48589216"><td class="cellrowborder" valign="top" width="12%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="dli_02_0039__en-us_topic_0069077803_p43412436">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="11.64%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="dli_02_0039__en-us_topic_0069077803_p26746391">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="11.709999999999999%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="dli_02_0039__p288182311211">String</p>
</td>
<td class="cellrowborder" valign="top" width="64.64999999999999%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="dli_02_0039__p1310472724012">Project ID, which is used for resource isolation. For details about how to obtain its value, see <a href="dli_02_0183.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="dli_02_0039__s23efeb265f5547b185ae9824f2c33bf4"><h4 class="sectiontitle">Request</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0039__en-us_topic_0069077916_table53369778" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="dli_02_0039__en-us_topic_0069077916_row2607862"><th align="left" class="cellrowborder" valign="top" width="13.5%" id="mcps1.3.3.2.2.5.1.1"><p id="dli_02_0039__en-us_topic_0069077916_p14149210296">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.64%" id="mcps1.3.3.2.2.5.1.2"><p id="dli_02_0039__ad6ac0587ffb9451a8c08638dc5eeff31">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.05%" id="mcps1.3.3.2.2.5.1.3"><p id="dli_02_0039__en-us_topic_0069077916_p181498118295">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.81%" id="mcps1.3.3.2.2.5.1.4"><p id="dli_02_0039__en-us_topic_0069077916_p61491811298">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0039__en-us_topic_0069077916_row50061100"><td class="cellrowborder" valign="top" width="13.5%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0039__en-us_topic_0069077916_p28417282">user_name</p>
</td>
<td class="cellrowborder" valign="top" width="11.64%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0039__en-us_topic_0069077916_p20098542">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="18.05%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0039__en-us_topic_0069077916_p17369173">String</p>
</td>
<td class="cellrowborder" valign="top" width="56.81%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0039__en-us_topic_0069077916_p64725793">Name of the user who is granted with usage permission on a queue or whose queue usage permission is revoked or updated.</p>
</td>
</tr>
<tr id="dli_02_0039__en-us_topic_0069077916_row45661233"><td class="cellrowborder" valign="top" width="13.5%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0039__en-us_topic_0069077916_p7572367">action</p>
</td>
<td class="cellrowborder" valign="top" width="11.64%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0039__en-us_topic_0069077916_p9381957">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="18.05%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0039__en-us_topic_0069077916_p21741052">String</p>
</td>
<td class="cellrowborder" valign="top" width="56.81%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0039__en-us_topic_0069077916_p16194779">Grants or revokes the permission. The parameter value can be <strong id="dli_02_0039__b842352706111654">grant</strong>, <strong id="dli_02_0039__b842352706111657">revoke</strong>, or <strong id="dli_02_0039__b84235270611170">update</strong>.</p>
<ul id="dli_02_0039__ul47762655161943"><li id="dli_02_0039__li19832010161943"><strong id="dli_02_0039__b842352706111754">grant</strong>: Indicates to grant users with permissions.</li><li id="dli_02_0039__li20261679161943"><strong id="dli_02_0039__b84235270611189">revoke</strong>: Indicates to revoke permissions.</li><li id="dli_02_0039__li58312788161943"><strong id="dli_02_0039__b842352706111823">update</strong>: Indicates to clear all the original permissions and assign the permissions in the provided permission array.</li></ul>
<div class="note" id="dli_02_0039__note18490191317017"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dli_02_0039__p74913133018">Users can perform the <strong id="dli_02_0039__b842352706111729">update</strong> operation only when they have been granted with the <strong id="dli_02_0039__b842352706111721">grant</strong> and <strong id="dli_02_0039__b842352706111725">revoke</strong> permissions.</p>
</div></div>
</td>
</tr>
<tr id="dli_02_0039__en-us_topic_0069077916_row21871945"><td class="cellrowborder" valign="top" width="13.5%" headers="mcps1.3.3.2.2.5.1.1 "><p id="dli_02_0039__en-us_topic_0069077916_p26797084">privileges</p>
</td>
<td class="cellrowborder" valign="top" width="11.64%" headers="mcps1.3.3.2.2.5.1.2 "><p id="dli_02_0039__en-us_topic_0069077916_p23080233">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="18.05%" headers="mcps1.3.3.2.2.5.1.3 "><p id="dli_02_0039__en-us_topic_0069077916_p57559574">Array of Objects</p>
</td>
<td class="cellrowborder" valign="top" width="56.81%" headers="mcps1.3.3.2.2.5.1.4 "><p id="dli_02_0039__p36791614152310">Permission granting information. For details, see <a href="#dli_02_0039__table11117114202212">Table 3</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="dli_02_0039__table11117114202212"></a><a name="table11117114202212"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0039__table11117114202212" frame="border" border="1" rules="all"><caption><b>Table 3 </b>privileges parameters</caption><thead align="left"><tr id="dli_02_0039__row611881482210"><th align="left" class="cellrowborder" valign="top" width="10.71%" id="mcps1.3.3.3.2.5.1.1"><p id="dli_02_0039__p1011814142228">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.43%" id="mcps1.3.3.3.2.5.1.2"><p id="dli_02_0039__p1211951412214">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.25%" id="mcps1.3.3.3.2.5.1.3"><p id="dli_02_0039__p1211920147224">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="64.61%" id="mcps1.3.3.3.2.5.1.4"><p id="dli_02_0039__p611971411226">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0039__row71209141226"><td class="cellrowborder" valign="top" width="10.71%" headers="mcps1.3.3.3.2.5.1.1 "><p id="dli_02_0039__p10121151412217">object</p>
</td>
<td class="cellrowborder" valign="top" width="9.43%" headers="mcps1.3.3.3.2.5.1.2 "><p id="dli_02_0039__p4121014172211">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15.25%" headers="mcps1.3.3.3.2.5.1.3 "><p id="dli_02_0039__p10121214162213">String</p>
</td>
<td class="cellrowborder" valign="top" width="64.61%" headers="mcps1.3.3.3.2.5.1.4 "><p id="dli_02_0039__p17952201213315">Data objects to be assigned. If they are named:</p>
<ul id="dli_02_0039__ul149821243153210"><li id="dli_02_0039__li2098214433323"><strong id="dli_02_0039__b13574544195511">databases.<em id="dli_02_0039__i205731944145515">Database name</em></strong>, data in the entire database will be shared.</li><li id="dli_02_0039__li18982643153218"><strong id="dli_02_0039__b94549119381">databases.<em id="dli_02_0039__i74538118388">Database name</em>.tables.<em id="dli_02_0039__i8453211193811">Table name</em></strong>, data in the specified table will be shared.</li><li id="dli_02_0039__li109821743133217"><strong id="dli_02_0039__b842352706113034">databases.<em id="dli_02_0039__i842352697113056">Database name</em>.tables.<em id="dli_02_0039__i842352697113059">Table name</em>.columns.<em id="dli_02_0039__i842352697113149">Column name</em></strong>, data in the specified column will be shared.</li><li id="dli_02_0039__li9982114323215"><strong id="dli_02_0039__b626154775617">jobs.flink.<em id="dli_02_0039__i1925185316569">Flink job ID</em></strong>, data the specified job will be shared.</li><li id="dli_02_0039__li1398384303215"><strong id="dli_02_0039__b886717725814">groups. <em id="dli_02_0039__i9175134581">Package group name</em></strong>, data in the specified package group will be shared.</li><li id="dli_02_0039__li199832043183212"><strong id="dli_02_0039__b979094555812">resources. <em id="dli_02_0039__i2796649115818">Package name</em></strong>, data in the specified package will be shared.</li></ul>
</td>
</tr>
<tr id="dli_02_0039__row16121914142211"><td class="cellrowborder" valign="top" width="10.71%" headers="mcps1.3.3.3.2.5.1.1 "><p id="dli_02_0039__p17122111442213">privileges</p>
</td>
<td class="cellrowborder" valign="top" width="9.43%" headers="mcps1.3.3.3.2.5.1.2 "><p id="dli_02_0039__p11221140224">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15.25%" headers="mcps1.3.3.3.2.5.1.3 "><p id="dli_02_0039__p181221714182211">Array of Strings</p>
</td>
<td class="cellrowborder" valign="top" width="64.61%" headers="mcps1.3.3.3.2.5.1.4 "><p id="dli_02_0039__p1212261416229">List of permissions to be granted, revoked, or updated. </p>
<div class="note" id="dli_02_0039__note412271412213"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dli_02_0039__p1412210142221">If <span class="parmname" id="dli_02_0039__parmname65951213181914"><b>Action</b></span> is <span class="parmname" id="dli_02_0039__parmname18527111916191"><b>Update</b></span> and the update list is empty, all permissions of the user in the database or table are revoked.</p>
</div></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0039__s2abe68e5f6df419f83a67c17b36a4bcc"><h4 class="sectiontitle">Response</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0039__en-us_topic_0069077916_table4786990" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Response parameters</caption><thead align="left"><tr id="dli_02_0039__en-us_topic_0069077916_row52019407"><th align="left" class="cellrowborder" valign="top" width="11.1%" id="mcps1.3.4.2.2.5.1.1"><p id="dli_02_0039__en-us_topic_0069077916_p85149332910">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.59%" id="mcps1.3.4.2.2.5.1.2"><p id="dli_02_0039__p4488192513255">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.29%" id="mcps1.3.4.2.2.5.1.3"><p id="dli_02_0039__en-us_topic_0069077916_p105143342916">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="67.02%" id="mcps1.3.4.2.2.5.1.4"><p id="dli_02_0039__en-us_topic_0069077916_p17514733296">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0039__en-us_topic_0069077916_row15291011"><td class="cellrowborder" valign="top" width="11.1%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0039__en-us_topic_0069077916_p30612383">is_success</p>
</td>
<td class="cellrowborder" valign="top" width="10.59%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0039__p13489192562518">No</p>
</td>
<td class="cellrowborder" valign="top" width="11.29%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0039__en-us_topic_0069077916_p58126760">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="67.02%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0039__p2699162916159">Whether the request is successfully executed. Value <span class="parmvalue" id="dli_02_0039__parmvalue8198034161044"><b>true</b></span> indicates that the request is successfully executed.</p>
</td>
</tr>
<tr id="dli_02_0039__en-us_topic_0069077916_row28715415"><td class="cellrowborder" valign="top" width="11.1%" headers="mcps1.3.4.2.2.5.1.1 "><p id="dli_02_0039__en-us_topic_0069077916_p44247284">message</p>
</td>
<td class="cellrowborder" valign="top" width="10.59%" headers="mcps1.3.4.2.2.5.1.2 "><p id="dli_02_0039__p2048982515254">No</p>
</td>
<td class="cellrowborder" valign="top" width="11.29%" headers="mcps1.3.4.2.2.5.1.3 "><p id="dli_02_0039__en-us_topic_0069077916_p60598252">String</p>
</td>
<td class="cellrowborder" valign="top" width="67.02%" headers="mcps1.3.4.2.2.5.1.4 "><p id="dli_02_0039__p069962915150">System prompt. If execution succeeds, the parameter setting may be left blank.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0039__section15772143623410"><h4 class="sectiontitle">Example Request</h4><pre class="screen" id="dli_02_0039__screen24130062153430">{
"user_name": "user2",
"action": "grant",
"privileges": [
{
"object": "databases.db1.tables.tb2.columns.column1",
"privileges": [
"SELECT"
]
},
{
"object": "databases.db1.tables.tbl",
"privileges": [
"DROP_TABLE"
]
},
{
"object": "databases.db1",
"privileges": [
"SELECT"
]
}
]
}</pre>
</div>
<div class="section" id="dli_02_0039__section59635464345"><h4 class="sectiontitle">Example Response</h4><pre class="screen" id="dli_02_0039__screen59959702153440">{
"is_success": true,
"message": ""
}</pre>
</div>
<div class="section" id="dli_02_0039__sf39cfd445ad24e9e82754fcb0027179d"><h4 class="sectiontitle">Status Codes</h4><p id="dli_02_0039__a04144ca3a08e4576b386c6a98f43a2ae"><a href="#dli_02_0039__tb12870f1c5f24b27abd55ca24264af36">Table 5</a> describes the status code.</p>
<div class="tablenoborder"><a name="dli_02_0039__tb12870f1c5f24b27abd55ca24264af36"></a><a name="tb12870f1c5f24b27abd55ca24264af36"></a><table cellpadding="4" cellspacing="0" summary="" id="dli_02_0039__tb12870f1c5f24b27abd55ca24264af36" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Status codes</caption><thead align="left"><tr id="dli_02_0039__r8d54231f95b14c01a5e55e95f3b2e838"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.7.3.2.3.1.1"><p id="dli_02_0039__ab49d21f312644072a331f43e92baf853">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70%" id="mcps1.3.7.3.2.3.1.2"><p id="dli_02_0039__aea1d3bd107bb4c499da79a88832d256c">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_02_0039__r211ad4eb571d4d938e5579998723174e"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0039__a3153e07b3a9749adba92599fe6628fbf">200</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0039__p10675142010516">Authorization succeeds.</p>
</td>
</tr>
<tr id="dli_02_0039__row44937531727"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0039__p184941532219">400</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0039__p2049413539219">Request error.</p>
</td>
</tr>
<tr id="dli_02_0039__row11188531568"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="dli_02_0039__p31891733561">500</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="dli_02_0039__p1789413865719">Internal service error.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_02_0039__section13596141025715"><h4 class="sectiontitle">Error Codes</h4><p id="dli_02_0039__p420584425712">If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see <a href="dli_02_0056.html">Error Code</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_02_0036.html">Permission-related APIs</a></div>
</div>
</div>