Use the set-user operation to change settings of the protected directory user.

Request Packet Structure

A request XML packet changing protected directory user settings includes the set-user operation node:

<packet>
<protected-dir>
<set-user>
...
</set-user>
</protected-dir>
</packet>

The set-user node is presented by type ProtectedDirSetInput (protected_dir.xsd), and its graphical representation is as follows:

image 49425

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.

  • The filter node is required. It specifies the filtering rule. For details, refer to the Available Filters section. Data type: ProtectedDirUserFilter (protected_dir.xsd).

  • The values node is required. It specifies the protected directory name. The node is presented by type ProtectedDirUser (protected_dir.xsd). Its graphical representation is as follows:

    image 49468

  • The login node is optional. It specifies the protected directory user login. Data type: string.

  • The password node is optional. It specifies the protected directory user password. Data type: string.

  • The password-type node is optional. It specifies the protected directory user password type. Data type: string. Allowed values: plain | crypt.

Note: When creating request packets, put nodes and elements in the order they follow in the packet structure.

Response Packet Structure

The set-user node of the output XML packet is presented by type ProtectedDirSetUserOutput (protected_dir.xsd) and structured as follows:

image 49434.gif

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.

  • The result node is required. It wraps the response retrieved from the server. Data type: resultFilterType (common.xsd).
  • The status node is required. It specifies the execution status of the operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the operation fails. Data type: string.
  • The filter-id node is required if the request packet is valid . It returns the filtering rule parameter. For details, refer to the Available Filters section. Data type: anySimple.
  • The id node is required if the operation succeeds . It returns the ID of the protected directory user whose settings were changed. Data type: integer.

Samples

Changing preferences of a single protected directory user

The packet that changes preferences of a protected directory user with ID 1 looks as follows:

<packet>
<protected-dir>
    <set-user>
       <filter>
         <id>1</id>
       </filter>
       <values>
         <password>qweqwe</password>
         <password-type>plain</password-type>
       </values>
    </set-user>
  </protected-dir>
</packet>

Response:

<packet>
<protected-dir>
      <set-user>
        <result>
          <status>ok</status>
          <filter-id>1</filter-id>
          <id>1</id>
        </result>
      </set-user>
    </protected-dir>
</packet>

If the user was not found, the response from the server looks as follows:

<packet>
<protected-dir>
  <set-user>
    <result>
     <status>error</status>
     <errcode>1013</errcode>
     <errtext>User is not found</errtext>
     <filter-id>12</filter-id>
    </result>
  </set-user>
</protected-dir>
</packet>

If no password was specified in the request packet, the response from the server looks as follows:

<packet>
<protected-dir>
  <set-user>
    <result>
     <status>error</status>
     <errcode>1019</errcode>
     <errtext>Invalid value for 'password' specified</errtext>
     <filter-id>12</filter-id>
    </result>
  </set-user>
</protected-dir>
</packet>

Changing preferences of multiple protected directory users

The packet that changes preferences of all users of the protected directory with ID 1 looks as follows:

<packet>
<protected-dir>
    <set-user>
       <filter>
         <pd-id>1</pd-id>
       </filter>
       <values>
         <password>qweqwe</password>
         <password-type>plain</password-type>
       </values>
    </set-user>
  </protected-dir>
</packet>

Response:

<packet>
<protected-dir>
      <set-user>
        <result>
          <status>ok</status>
          <filter-id>1</filter-id>
          <id>13</id>
        </result>
        <result>
          <status>ok</status>
          <filter-id>1</filter-id>
          <id>14</id>
        </result>
      </set-user>
    </protected-dir>
</packet>