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.

xml-api/accountsummary

Discussion in 'General Discussion' started by monaghan, Jun 25, 2008.

  1. monaghan

    monaghan Well-Known Member

    Joined:
    Jan 7, 2004
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    I use this function to query whether I can use an account name during the creation process of an external application.

    When I query as root this reports an account, however when run as a reseller, it only returns a value if the account is owned by the reseller, if the account name is taken by another reseller it returns nothing and we then get an error when attempting to create an account.

    Is it possible for this to return an indicator that the account name is in use but not give out details or is there another function I can call to validate an account name or to generate a valid one from the domain name or some other string?

    Whilst I can run as root on the servers we manage, some of our customers are resellers on other suppliers servers, so I need a solution that will work at the reseller level.

    I could just keep creating new usernames and running the createaccount function until it doesn't fail, but that's not very nice code :(
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,460
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The XML-API uses the same functionality available within WHM. If a reseller is unable to view all accounts within WHM then likewise the reseller cannot use the XML-API to view all accounts.

    What is likely needed for this scenario is a function: usernameexists which simply returns true (1) or false (0).
     
  3. monaghan

    monaghan Well-Known Member

    Joined:
    Jan 7, 2004
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    That sounds ideal, as you're staff, will you pop that in the suggestion box?

    Any idea what current billing systems do? Do they just loop until they get an acceptable account name?
     
  4. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    You could just call the xml-api function to listaccounts and then exclude all those usernames.
     
  5. monaghan

    monaghan Well-Known Member

    Joined:
    Jan 7, 2004
    Messages:
    51
    Likes Received:
    0
    Trophy Points:
    6
    Wouldn't the list accounts function also be limited to the reseller's view of things?
     
Loading...

Share This Page