The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Email::listpopswithdisk and multiple domains

Discussion in 'cPanel Developers' started by k_shehadeh, May 4, 2009.

  1. k_shehadeh

    k_shehadeh Member

    Joined:
    Mar 27, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    I'm trying to understand why my primary user on a WHM server is unable to get a listing of a domain in a separate account. I think I don't understand the different relationships between users and WHM accounts. Here's the situation:

    I have a WHM account with a user "user1". In this WHM account there are two cPanel accounts (sorry if I'm using the wrong words here). The first is for domain "mydomain1.com" and the second is for "mydomain2.com". The primary user for the "mydomain1.com" account is "user1" and the primary user for the "mydomain2.com" account is "user2".

    So:

    WHM Account >> "user1"
    "mydomain1.com" >> "user1"
    "mydomain2.com" >> "user2"

    Now, I'm using the Email::listpopswithdisk to try and retrieve email accounts for a domain. The problem is when I login as "user1" with the API and try to retrieve email accounts for "mydomain2.com", I get nothing back. This kind of makes since that account is owned by "user2". But what confuses me then is why one of the arguments for this API call is "domain" when the logged in user can apparently only access the domain of their own account (even if the user is the WHM account holder).

    I know this is a convoluted question but I can't think of a better way to ask it. Any help getting me to understand would be very much appreciated.

    Thanks,
    Karim
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Even though you are logging in as the reseller user (user1), which cPanel user are you passing to the XML API (via the user= URL parameter) when attempting to retrieve the email accounts for user2?
     
  3. k_shehadeh

    k_shehadeh Member

    Joined:
    Mar 27, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the response. To answer your question, it doesn't seem to matter what the "user" parameter is - I don't even have to supply a user and I still get back the email accounts associated with the authenticated user (as opposed to the one in the url parameter list).
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Are you using the XML API over a WHM port (2087 or 2086) or a cPanel port (2083 or 2082)?
     
  5. k_shehadeh

    k_shehadeh Member

    Joined:
    Mar 27, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Over a cPanel port. I thought i had to since I'm using an API2 call. No?
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The XML API can be used over the WHM ports even for API2 calls.

    When you use the cPanel ports, you will only be able to access things for the cPanel user you are logged in as. However, with using the WHM ports, you can login as a reseller and then get information about the cPanel accounts that are under your reseller account.
     
  7. k_shehadeh

    k_shehadeh Member

    Joined:
    Mar 27, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Okay, that worked. Thanks! When using the WHM port, I *had* to specify a user as a URL parameter. Is there a way to retrieve all email accounts across all WHM accounts with a single call?
     
  8. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    As this is an API1/API2 call, this needs to be done for each individual cPanel user. However you could probably use the XML API's listaccts function to get a list of all cPanel accounts for that reseller and then loop through each account to get the information you need for every WHM account owned by that reseller.
     
  9. k_shehadeh

    k_shehadeh Member

    Joined:
    Mar 27, 2009
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Okay, yeah. That's what I figured. Thanks again!
     
Loading...

Share This Page