You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • UAPI Functions - DirectoryPrivacy::list_users
Skip to end of metadata
Go to start of metadata

Description

This function returns the users who can access a password-protected directory on the cPanel account.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/DirectoryPrivacy/list_users?dir=/home/example/example.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List the users who can access the /home/example/example.com directory.
$list_users = $cpanel->uapi(
    'DirectoryPrivacy', 'list_users',
    array(
        'dir'     => '/home/example/example.com',
  )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List the users who can access the /home/example/example.com directory.
my $list_users = $cpliveapi->uapi(
    'DirectoryPrivacy', 'list_users',
    {
        'dir'      => '/home/example/example.com',
    }
);


Note:

For more information, read our Guide to the LiveAPI System.

 

 Command Line
uapi --user=username DirectoryPrivacy list_users dir=/home/example/example.com 


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{ 
   "warnings":null,
   "status":1,
   "data":[ 
      "example1",
      "example2"
   ],
   "metadata":{ 
      "transformed":1
   },
   "errors":null,
   "messages":null
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
dirstring

Required

The directory for which to return users.

  • An absolute directory path on the cPanel account.
  • A filepath relative to the user's home directory.
/home/example/example.com

Returns

ReturnTypeDescriptionPossible valuesExample

arrayA list of users who can access the directory.An array of usernames.

example1,

example2