First, a distinction must be made between two easily confused concepts, "Feature Lists" and "Packages". There is a very important difference between these two:
Feature lists are usually assigned to packages and then it is packages that are assigned to users/accounts.
So it is not possible to directly assign a feature list to a user/account. First, a feature list must be created, and then it must be assigned to a package, and consequently, that package can be assigned to a user/account. So the order should be represented in this way:
Feature > Feature List > Package > User/Account
You can find relevant information on how each step works from these links:
(For creating and editing a feature list)
https://docs.cpanel.net/whm/packages/feature-manager/
(For creating an editing a package)
https://docs.cpanel.net/whm/packages/add-a-package/
https://docs.cpanel.net/whm/packages/add-a-package/
(For assigning a package to a user/account)
https://docs.cpanel.net/whm/account-functions/modify-an-account/
How To Verify If A User Has Access To A Feature?
You can run this command to see if a particular account/user has access to a feature:
whmapi1 verify_user_has_feature user=$USER_NAME feature=$FEATURE_ID
A complete list of all feature names can be found from this link:
https://docs.cpanel.net/whm/packages/feature-manager/
And to get a feature ID associated with a given feature you should run the below command and then search for the feature ID next to the feature name you are looking for:
whmapi1 get_feature_names | grep -i subdomain -C 1
-
id: subdomainstats
name: Subdomain Stats
-
--
-
id: subdomains
name: Subdomains
-
Here clearly the feature ID that we need to use is "subdomains", so now we can finally run the command to verify if a user has access to a feature. A sample output for the command looks like this:
whmapi1 verify_user_has_feature user=cptest feature=subdomains
---
data:
has_feature: 0
query_feature: subdomains
metadata:
command: verify_user_has_feature
reason: OK
result: 1
version: 1
As you can see the user "cptest" does not have access to the feature "subdomain". The reason why this user does not have access to this feature is that the feature list assigned to the package which is assigned to the user does not have the "subdomain" feature enabled. You can see both the package and the feature list associated with this user by running this command:
egrep -iE "(plan|feature)" /var/cpanel/users/cptest
FEATURELIST=no-subdomain
PLAN=new-package
Here the package assigned to the user is called "new-package" and the feature list associated with the package is the "no-subdomain" feature list. We also have another feature list that has the "subdomain" feature enabled called "with-subdomain":
grep subdomain /var/cpanel/features/with-subdomain
subdomains=1
subdomainstats=1
Now, in order to allow the user "cptest" to have access to the feature "subdomain", all we have to do is to assign this new feature list (with-subdomain) to the package "new-package" from the WHM interface (WHM > Packages > Edit A Package > "Choose your package" > "Hit edit" > "Choose feature list from the dropdown"). After that change has been made we can verify the change by running this command again:
egrep -iE "(plan|feature)" /var/cpanel/users/cptest
FEATURELIST=with-subdomain
PLAN=new-package
Afterward, the user should have access to the "subdomain" feature, which can be confirmed by running the original API command:
whmapi1 verify_user_has_feature user=cptest feature=subdomains
---
data:
has_feature: 1
query_feature: subdomains
metadata:
command: verify_user_has_feature
reason: OK
result: 1
version: 1