<< Click to Display Table of Contents >> Set Multiple Resource/Operation Permissions for Users/Groups/Roles (The original resource permissions will be overwritten) |
![]() ![]() ![]() |
Version: 9.1
Request address |
http://ip:port/bi/api?action=setAuthorization&token=xxxx |
|
Request message |
Request parameter |
required parameter:xmlData (required) <?xml version="1.0" encoding="UTF-8"?> <info> <authorization> <identity> <ref> <type>user</type> <name>user1</name> </ref> <ref> <type>group</type> <name>group-1</name> <parent>group</parent> </ref> <ref> <type>role</type> <name>test_role</name> </ref> </identity> <rperm> <ref> <type>Query</type> </ref> <ref> <type>db</type> <path>test</path> </ref> </rperm> <wperm> <ref> <type>db</type> <path>test</path> </ref> </wperm> </authorization> </info> |
parametric description |
The parameter is node information: 1) identity-ref-type(required): The type of node to set,including three types: user, group, role. 2) identity-ref-name(required): The name of node. 3) identity-ref-parent(required):The path to when the node is group. 4) rperm(optional): Read Permission。 5) rperm-ref-type(required): The type of node, including resource type and operation type. 6) rperm-ref-path (required when setting read permission): Need to set the path of the node. When selecting the operation type, this item does not need to be filled. 7) wperm (optional): Write Permission. 8) wperm-ref-type (required when setting write permissions): Need to set the type of node, including resource type and operation type (see appendix). 9) wperm-ref-path (required when setting write permission): Need to set the path of the node. When selecting the operation type, this item does not need to be filled. Explanation: 1) There can be multiple identity-refs, but at least one. 2) Fill in at least one of rperm and wperm. 3) This method will overwrite the previous permission settings. |
|
Sample |
function setAuthorization() { var xml = getXml(); $.post("http://" + ip + ":" + port + "/" + project + "/api?action=setAuthorization&token=xxxx", {xmlData : xml}, function(result) { writeXml(result); }); } |
|
Response message |
Response result
|
1) Successful operation <?xml version="1.0" encoding="UTF-8"?> <results> <result> <level>1</level> <message>Operates successfully.</message> </result> </results> 2) Operation failed <?xml version="1.0" encoding="UTF-8"?> <results> <result> <level>6</level> <message>The Users, Groups or Roles "user1" does not exist.</message> </result> </results> or <?xml version="1.0" encoding="UTF-8"?> <results> <result> <level>6</level> <message>The resource or operation "test" could not be found. </message> </result> </results> |
Result description |
The response result information is xml. direct parse. 1) Level return type, different values represent different return status, see appendix. 2) Message is the interface operation result information. |