Guide to WHM Plugins - The ACL Object Perl Module

Introduction

The ACL object Perl module configures the ACL's namespace and display information. Create the ACL object Perl module in the /usr/local/cpanel/Cpanel/Config/ConfigObj/Driver/ directory. This file creates a Cpanel::Config::ConfigObj::Interface::Config::v1 object, with additional information about the object's visibility.

The ACL object Perl module

The following example code creates an object for the ExampleACL namespace:

package Cpanel::Config::ConfigObj::Driver::ExampleACL;
 
use strict;
 
our @ISA = qw(Cpanel::Config::ConfigObj::Interface::Config::v1);   
 
our $VERSION = '1.0';
 
sub init {
    my $class        = shift;
    my $software_obj = shift;
 
    my $ExampleACL_defaults = {
        'thirdparty_ns' => "ExampleACL",
        'meta'          => {},
    };
    my $self = $class->SUPER::base( $ExampleACL_defaults, $software_obj );
 
    return $self;
}
 
sub info {
    my ($self)   = @_;
    my $meta_obj = $self->meta();
    my $abstract = $meta_obj->abstract();
    return $abstract;
}
 
sub acl_desc {
    return [
        {
            'acl'              => 'software-ExampleACL',
            'default_value'    => 0,
            'default_ui_value' => 1,
            'name'             => 'ExampleACL test',
            'acl_subcat'       => 'Third Party Services',
        },
    ];
}
 
1; 

Package the module

package Cpanel::Config::ConfigObj::Driver::ExampleACL;

This declaration instructs Perl to treat all of the file's functions as part of the Cpanel::Config::ConfigObj::Driver::ExampleACL namespace.

For more information, read perldoc.perl.org's package documentation.

Set the strict pragma

use strict;

This declaration instructs Perl to return errors if the file contains potentially unsafe code.

For more information, read perldoc.perl.org's strict documentation.

Specify the class's parents

our @ISA = qw(Cpanel::Config::ConfigObj::Interface::Config::v1);   

This declaration manually sets the contents of the @ISA array.

For more information, read perldoc.perl.org's perlobj documentation.

Declare a module version

our $VERSION = '1.0';  

This declaration creates the variable $VERSION and sets it to 1.0. This allows you to differentiate between this and future versions of your module.

Initialize the ACL's custom namespace

sub init {
    my $class        = shift;
    my $software_obj = shift;
 
    my $ExampleACL_defaults = {
        'thirdparty_ns' => "ExampleACL",
        'meta'          => {},
    };
    my $self = $class->SUPER::base( $ExampleACL_defaults, $software_obj );
 
    return $self;
}

The init subroutine initializes the ACL's custom namespace (ExampleACL).

Configure the object's information

sub info {
    my ($self)   = @_;
    my $meta_obj = $self->meta();
    my $abstract = $meta_obj->abstract();
    return $abstract;
}

The info subroutine configures the ACL's object's information.

Configure the ACL's description

sub acl_desc {
    return [
        {
            'acl'              => 'software-ExampleACL',
            'default_value'    => 0,
            'default_ui_value' => 1,
            'name'             => 'ExampleACL',
            'acl_subcat'       => 'Third Party Services',
        },
    ];
}

The acl_desc subroutine configures the ACL's description. This subroutine must return the following parameters and values:

Parameter

Type

Description

Possible values

Example

 acl

 string

 The ACL's internal name.

 A valid string.

 software-ExampleACL

 default_value

 boolean

 The ACL's default setting, to add to the ACL lists for WHM users that already exist.

  • 1 — Enabled.
  • 0 — Disabled.

 0

 default_ui_value

   boolean

 Whether the ACL displays in WHM's  Edit Reseller Nameservers and Privileges interface (Home >> Resellers >> Edit Reseller Nameservers and Privileges).

  • 1 — Display.
  • 0 — Do not display.

Note:

If you set this value to 0, server administrators can still set the ACL through the WHM API. 

 1

 name

 string

 The ACL's display name (Feature List name) in the WHM interface.

 A valid string.

 ExampleACL

 acl_subcat

 string

The subcategory name under which the ACL will display in the WHM interface.

 An existing category name:

  • Account Information
  • Account Management
  • Accounts
  • Advanced Account Management
  • Clustering
  • cPanel Management
  • Dns
  • Locales
  • Package Access
  • Packages
  • Packages Creation
  • Server Information
  • Services
  • Third Party Services
  • Troubleshooting

 Third Party Services

 

  • 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....