UAPI Functions - UserManager::edit_user

Description

This function edits a subaccount.

Examples 


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/UserManager/edit_user?alternate_email=robert%40example.com&domain=example.com&password=12345luggage&real_name=Bob%20Doe&services.email.enabled=1&services.email.quota=2&services.ftp.enabled=1&services.ftp.homedir=%2Fbob&services.webdisk.enabled=1&services.webdisk.private=0&services.webdisk.homedir=%2Fbob&services.webdisk.perms=0&type=sub&username=example1

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Edit subaccount.
$Usermanager $cpanel->uapi(
    'UserManager''edit_user',
    array(
        'alternate_email'           =>   'robert@example.com',
        'domain'                    =>   'example.com',
        'password'                  =>   '12345luggage',
        'real_name'                 =>   'Bob Doe',
        'services.email.enabled'    =>   '1',
        'services.email.quota'      =>   '2',
        'services.ftp.enabled'      =>   '1',
        'services.ftp.homedir'      =>   '/bob',
        'services.webdisk.enabled'  =>   '1',
        'services.webdisk.private'  =>   '0',
        'services.webdisk.homedir'  =>   '/bob',
        'services.webdisk.perms'    =>   '0',
        'type'                      =>   'sub',
        'username'                  =>   'example1',
        )
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# Edit subaccount.
my $Usermanager $cpliveapi->uapi(
    'UserManager''edit_user',
    {
        'alternate_email'           =>   'robert@example.com',
        'domain'                    =>   'example.com',
        'password'                  =>   '12345luggage',
        'real_name'                 =>   'Bob Doe',
        'services.email.enabled'    =>   '1',
        'services.email.quota'      =>   '2',
        'services.ftp.enabled'      =>   '1',
        'services.ftp.homedir'      =>   '/bob',
        'services.webdisk.enabled'  =>   '1',
        'services.webdisk.private'  =>   '0',
        'services.webdisk.homedir'  =>   '/bob',
        'services.webdisk.perms'    =>   '0',
        'type'                      =>   'sub',
        'username'                  =>   'example1',
    }
);

 cPanel Template Toolkit

<!-- Edit subaccount. -->
[% execute('UserManager', 'edit_user', {'alternate_email' => 'robert@example.com', 'domain' => 'example.com', 'password' => '12345luggage', 'real_name' => 'Bob Doe', 'services.email.enabled' => '1', 'services.email.quota' => '2', 'services.ftp.enabled' => '1', 'services.ftp.homedir' => '/bob', 'services.webdisk.enabled' => '1', 'services.webdisk.private' =>  '0', 'services.webdisk.homedir' => '/bob', 'services.webdisk.perms' => '0', 'type' => 'sub', 'username' => 'example1'} ) %]

 Command Line

uapi --user=username UserManager edit_user alternate_email=robert%40example.com domain=example.com password=12345luggage real_name='Bob Doe' services.email.enabled=1 services.email.quota=2 services.ftp.enabled=1 services.ftp.homedir=%2Fbob services.webdisk.enabled=1 services.webdisk.private=0 services.webdisk.homedir=\/bob services.webdisk.perms=0 type=sub username=example1

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
    "messages": null,
    "errors": null,
    "status": 1,
    "metadata": {},
    "data": {
        "issues": [],
        "sub_account_exists": null,
        "can_set_quota": 0,
        "dismissed": null,
        "has_siblings": null,
        "full_username": "example1@example.com",
        "parent_type": null,
        "special": 0,
        "can_set_password": 1,
        "domain": "example.com",
        "merge_candidates": [],
        "guid": "EXAMPLE1:EXAMPLE.COM:56619A7B:093966B0A830D5ABA75A995A424663A7FDD9F63B9E7886A9065576551E598F46",
        "real_name": "Bob Doe",
        "can_delete": 1,
        "services": {
            "email": {
                "enabled": 1
            },
            "ftp": {
                "quota": "0.00",
                "enabled": 1,
                "homedir": "bob"
            },
            "webdisk": {
                "enabledigest": 0,
                "private": 0,
                "perms": "rw",
                "enabled": 1,
                "homedir": "bob"
            }
        },
        "phone_number": null,
        "avatar_url": null,
        "alternate_email": "robert@example.com",
        "username": "example1",
        "type": "sub",
        "synced_password": 1
    }
}

 

Note:

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

 

Parameters

Parameter

Type

Description

Possible values

Example

alternate_email

string

An alternate email address for the subaccount's user.

Note:

The cPanel account user could use this email address to contact the subaccount user if their primary email address's domain is unavailable.

This parameter defaults to null.

A valid email address.

 user@example.com 

avatar_url

string

 

Warning:

We reserved this parameter for future use. Do not use this parameter.

 

The user's subaccount profile photo.

This parameter defaults to null.

A valid HTTPS URL that points to an image file.

Note:

You must use the HTTPS protocol to prevent mixed content warnings when users view the photo from another HTTPS URL.

 

domain

string

Required

The subaccount user's associated domain.

A domain that the cPanel account owns.

example.com

password

string

Required

The subaccount's password.

Note:

The subaccount uses this password for email, FTP, and Web Disk services.

A secure password.

12345luggage

phone_number

string

 

Warning:

We reserved this parameter for future use. Do not use this parameter.

 

The subaccount user's phone number.

This parameter defaults to null.

A valid phone number that conforms to ITU-T'sE.164-recommended standard for the representation of telephone numbers.

+15551234567

real_name

string

The subaccount user's name.

This parameter defaults to null.

  • A first name.
  • A last name.
  • A first name and last name.
  • An empty string.

John Doe

services.email.enabled

Boolean

Whether to grant the subaccount email access.

This parameter defaults to 0.

  • 1 — Can access.
  • 0 — Cannot access.

1

services.email.quota

string

The subaccount's email disk space quota.

This parameter defaults to 0.

  • A positive integer between 1 and999999 that represents the maximum disk space that the subaccount may use, in Megabytes (MB).
  • 0 — The subaccount's disk space is unlimited.

500

services.ftp.enabled

Boolean

Whether to grant the subaccount FTP access.

This parameter defaults to 0.

  • 1 — Can access.
  • 0 — Cannot access.

1

services.ftp.homedir

string

The subaccount's FTP home directory.

Note:

This parameter is required if you enabled FTP access.

A relative path from the cPanel account's home directory.

Note:

The specified directorymust exist.

 

/subaccount

services.webdisk.enabled

Boolean

Whether to grant the subaccount Web Disk access.

This parameter defaults to 0.

  • 1 — Can access.
  • 0 — Cannot access.

1

 services.webdisk.enabledigest 

Boolean

Whether to enable Web Disk digest authentication.

Notes:

  • Only enable Digest Authentication for clients that require additional compatibility support on certain versions of Windows® operating systems. This compatibility support is only required on servers that use a self-signed certificate for the cpsrvd and cpdavddaemons.
  • We recommend that you do not use Digest Authentication.

This parameter defaults to 0.

  • 1 — Enabled.
  • 0 — Disabled.

0

services.webdisk.private

Boolean

Whether to set the Web Disk directory's permissions to public or private.

This parameter defaults to 0.

  • 1 — Private (0700).
  • 0 — Public(0755).

1

services.webdisk.homedir

string

The subaccount's Web Disk home directory.

Note:

This parameter is required if you enable Web Disk access.

A valid path, relative to the cPanel account's home directory.

/subaccount

services.webdisk.perms

string

Whether to grant write permissions to the subaccount.

Note:

The services.webdisk.homedirparameter determines the subaccount's Web Disk home directory.

This parameter defaults to rw.

  • ro — Read-only permissions.
  • rw — Read and write permissions.

rw

type

string

The type of account.

This parameter defaults to sub.

sub — A subaccount.

sub

username

string

Required

The subaccount's username.

 

A username that meets the subaccount name limitations.

  • Length — 64 characters
  • Characters — a-z, A-Z, 0-9,dot(.), hyphen(-), underscore(_).

Note:

This value does notinclude the domain name.

example

 

Returns

 

Return

Type

Description

Possible values

Example

alternate_email

string

An alternate email address for the subaccount's user.

A valid email address.

 user@example.com 

avatar_url

string

 The URL to the user's subaccount profile photo.

Note:

Use the HTTPS protocol to prevent mixed content warnings when users view it from another HTTPS URL.

 A valid HTTPS URL that points to an image file.

 

can_delete

boolean

Whether the cPanel account user can delete the subaccount.

  • 1 — Can delete.
  • 0 — Cannot delete.

0

can_set_password

boolean

Whether the cPanel account user can change the subaccount's password.

 

  • 1 — Can change password.
  • 0 — Cannot change password.

Note:

The function returns a 0 value for subaccounts who inherit their password from the cPanel account.

1

can_set_quota

boolean

Whether the cPanel account user can change the subaccount's disk usage quota.

  • 1 — Can change quota.
  • 0 — Cannot change quota.

0

dismissed

boolean

Whether the cPanel account user dismissed the merge prompt for the service account.

Note:

Only service accounts return this value.

  • 1 — Dismissed prompt.
  • 0 — Did not dismiss prompt.

1

domain

string

 The subaccount user's associated domain.

A domain that the cPanel account owns.

example.com

full_username

string

The subaccount's username and domain name.

 A valid username, the @ character, and the associated domain.

user@example.com

guid

string

 The subaccountunique identifier.

Note:

The subaccount's globally unique identifier (GUID) does not change when you adjust its other attributes.

The system assigned unique value.

 

issues

array

This array of hashes contains information about any issues or problems with the subaccount.

This array contains the type, area, service,message, used, and limit values.

 

type

string

The type of issue.

The function returns this value in theissues array.

  • error
  • warning
  • info

info

area

string

The affected section of cPanel & WHM.

quota

quota

service

string

The affected service.

The function returns this value in theissues array.

  • email
  • ftp
  • webdisk

email

message

string

The description of the issue.

The function returns this value in theissues array.

A message that contains a description of the issue.

Your account is over quota.

used

string

The number of Megabytes (MB) that the account currently uses.

The function returns this value in theissues array.

A positive integer.

2000

limit

string

The set quota Megabyte (MB) limit for the affected subaccount.

The function returns this value in theissues array.

A positive integer.

1500

merge_candidates

array

An array of hashes that represents the service accounts that the system could merge for this subaccount.

This array contains  the alternate_email,avatar_url, can_delete, can_set_password,can_set_quota, dismissed, domain,full_username, guid, has_siblings, issues,merge_candidates, parent_type, phone_number,real_name, services, special,sub_account_exists, synced_password, type,  andusername values.

 

has_siblings

boolean

Whether the service account shares afull_username value with another service account.

  • 1 — Shared.
  • 0 — Not shared.

0

parent_type

string

The type of account that could own the service account.

  • sub — A subaccount.
  • hypothetical — A hypothetical subaccount that does not yet exist, but the user could create as part of a merge.
  • null— Not a merge candidate.

 

 hypothetical

phone_number

string

The subaccount user's phone number.

A valid phone number that conforms to ITU-T'sE.164 recommended standard for the representation of telephone numbers.

+15551234567

real_name

string

The name of the subaccount's user.

  • A first name, a last name, or a first name and last name.
  • An empty string.

John Doe

services

hash

This hash contains  information about the  subaccount's access to email, FTP, and Web Disk.

This hash contains the email, ftp, and webdiskvalues.

 

email

hash

 This hash contains the information that indicates the subaccount's email status.

This hash contains the enabled and quota values.

 

enabled

boolean

Whether the  subaccount can  access Webmail, POP, and IMAP services.

  • 1 — Can access.
  • 0 — Cannot access.

1

quota

string

The subaccount's email disk space quota.

  • A positive integer between one and 999,999 that represents the maximum disk space that the subaccount may use, in megabytes (MB).
  • 0 — The subaccount's disk space is unlimited.

100

ftp

hash

 This hash contains the information that indicates the subaccount's FTP status.

This hash contains the enabled, quota, and homedirvalues.

 

enabled

boolean

Whether the  subaccount can access FTP.

  • 1 — Can access.
  • 0 — Cannot access.

0

quota

string

 The subaccount's FTP disk space quota.

  • An integer that represents the subaccount's maximum FTP disk usage, in Megabytes (MB).
  • A value of 0 grants the subaccount unlimited FTP disk space.

100

homedir

string

The subaccount's FTP home directory.

A relative path from the cPanel account's home directory on the server.

/subaccount

webdisk

hash

 This hash contains the information that indicates the subaccount's Web Disk status.

This hash contains the enabled, homedir, perms, and private values.

 

enabled

 boolean 

Whether the  subaccount can access Web Disk.

  • 1 — Can access.
  • 0 — Cannot access.

0

homedir

string

The path to the subaccount's directory, relative to the cPanel account's home directory.

A valid path.

/bob

perms

string

Whether to grant write permissions to the subaccount.

  • ro — Read-only permissions.
  • rw — Read and write permissions.

rw

private

boolean

Whether to set the Web Disk directory's permissions to public or private.

Notes:

  • When the directory is public, the home directory's permissions are 0755.
  • When the directory is private, the home directory's permissions are 0700.
  • 1 — Private.
  • 0 — Public.
 

0

special

boolean

Whether the account is a system-created special account that the user cannotremove.

 

  • 1 — A special account.
  • 0 — Not a special account.

1

 sub_account_exists 

boolean

 Whether a  subaccount exists with the same username.

  • 1 — Yes.
  • 0 — No.

Note:

The function returns this attribute as nullvalue if the account type is not a service account.

0

synced_password

boolean

 Whether the user has synchronized the  passwords for each of the subaccount'sservice accounts.

  • 1 — Passwords synchronized.
  • 0 — Passwords not synchronized.

Note:

The function returns this attribute as nullvalue if the account type is not a subaccount.

0

type

 string

The type of account.

  • sub — A subaccount.
  • hypothetical — A hypothetical subaccount that does not exist, but that the user could create as part of a merge.
  • service — A service account.
  • cpanel — The cPanel account.

sub

username

string

The username for the subaccount.

Notes:

This value does not include the domain name.

A username that meets the subaccount name limitations.

  • Length — 64 characters
  • Characters — a-z, A-Z, 0-9, dot (.), hyphen (-), underscore (_)

example

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....