• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

CCCSSS

New Pleskian
Hello, everyone! I am trying to remove a certain user from a certain database using their IDs.

Basically, my aim is to have 2 sets of databases. The first set will always consist of the same few databases. The second set will have databases dynamically created into and deleted out of it. I am using XML packets to do this. Everything was going well. My problem came in at removing certain users from having access to the first set of databases. The code in the this documentation page seems incomplete for that task...

Knowing the database id and user id, I tried this XML packet code and it is giving me an error. When I remove "<db-id>2</db-id>," the code works … and deletes the user entirely.

Anyone can tell me what's wrong with this xml packet code, or do I just need to find another way?

Code:
<packet>
<database>
   <del-db-user>

      <filter>
          <id>55</id>
          <db-id>2</db-id>
      </filter>

   </del-db-user>
</database>
</packet>
Error:
Code:
[system] => Array
        (
            [status] => error
            [errcode] => 1014
            [errtext] => Parser error: Request is invalid. Error in line 6: Element 'db-id': This element is not expected. Expected is ( id ).
        )



The documentation says:

This request packet removes the user with ID 55 from the database with ID 2.
Code:
<packet>
<database>
   <del-db-user>

      <filter>
          <id>55</id>
      </filter>

   </del-db-user>
</database>
</packet>

Where is this ID of 2, haha? I noticed that this particular page in the documentation has missing and incorrect info, as if parts had been copied and pasted. No disrespect to the author of the page.
 
I think the flow chart in the documentation is an exclusive "or", so either use id or use db-id. Have you tried that?
 
The documentation isn't very clear and on some points, sadly, even contradictory. The del-db-user operation however completely deletes a user. It does not remove a user from a specific database. There is no need to specify a database, as the operation deletes the user regardless of which database the user belongs to.

I get your confusion as the documentation wrongly and confusingly states:
This request packet removes the user with ID 55 from the database with ID 2.
It should state that it deletes the user with ID 55.

As for you objective I am afraid you cannot remove certain users from having access to particular databases using the XML API.
 
Back
Top