Introduction
The ACL metadata Perl module defines necessary functions for the ACL system. Create the ACL metadata Perl module in the /usr/local/cpanel/Cpanel/Config/ConfigObj/Driver/Namespace/
directory, where Namespace
is the ACL's namespace.
Important:
This file must be the META.pm
file.
The ACL metadata Perl module
The following example code configures metadata for the ExampleACL
ACL:
package Cpanel::Config::ConfigObj::Driver::ExampleACL::META; use strict; use Cpanel::Config::ConfigObj::Driver::ExampleACL (); sub meta_version { return 1; } sub get_driver_name { return 'ExampleACL_driver'; } sub content { my ($locale_handle) = @_; my $content = { 'vendor' => 'cPanel, Inc.', 'url' => 'www.cpanel.net', 'name' => { 'short' => 'ExampleACL Driver', 'long' => 'ExampleACL Driver for ExampleACL Plugin test module', 'driver' => get_driver_name(), }, 'since' => 'cPanel & WHM version 11.32.4', 'abstract' => "An ExampleACL driver for developers to emulate.", 'version' => $Cpanel::Config::ConfigObj::Driver::ExampleACL::VERSION, }; if ($locale_handle) { $content->{'abstract'} = $locale_handle->maketext("An ExampleACL driver for developers to emulate."); } return $content; } sub showcase { return; } 1;
Package the module
package Cpanel::Config::ConfigObj::Driver::ExampleACL::META;
This declaration instructs Perl to treat all of the file's functions as part of the Cpanel::Config::ConfigObj::Driver::ExampleACL::META
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.
Use the ACL object module
use Cpanel::Config::ConfigObj::Driver::ExampleACL ();
Set the ACL object module as a dependency.
For more information, read perldoc.perl.org's use documentation.
Set a metadata version
sub meta_version { return 1; }
The meta_version
subroutine sets a metadata version number.
Set the ACL's driver's name
sub get_driver_name { return 'ExampleACL_driver'; }
The get_driver_name
subroutine returns the ACL's driver's name (ExampleACL_driver
).
Configure the ACL's metadata
sub content { my ($locale_handle) = @_; my $content = { 'vendor' => 'cPanel, Inc.', 'url' => 'www.cpanel.net', 'name' => { 'short' => 'ExampleACL Driver', 'long' => 'ExampleACL Driver for ExampleACL Plugin test module', 'driver' => get_driver_name(), }, 'since' => 'cPanel & WHM version 11.32.4', 'abstract' => "An ExampleACL driver for developers to emulate.", 'version' => $Cpanel::Config::ConfigObj::Driver::ExampleACL::VERSION, }; if ($locale_handle) { $content->{'abstract'} = $locale_handle->maketext("An ExampleACL driver for developers to emulate."); } return $content; }
The content
subroutine configures the ACL's metadata. This subroutine must assign the following values to the $content
hash:
Parameter |
Type |
Description |
Possible values |
Example |
vendor |
string |
The custom ACL's vendor. |
A valid string. |
cPanel, Inc. |
url |
string |
The vendor's website. |
A valid URL. |
www.cpanel.net |
name |
hash |
A hash of ACL name information. |
This hash includes theshort, long, anddriverparameters. |
|
short |
string |
The ACL's driver's short name. Supply this value as part of the namehash. |
A valid string. |
ExampleACL Driver |
long |
string |
The ACL'sdriver's long name. Supply this value as part of the namehash. |
A valid string. |
ExampleACL Driver for ExampleACL Plugin test module |
driver |
string |
The ACL's driver's internal name. Supply this value as part of the namehash. |
Use theget_driver_namesubroutine to supply this value. |
get_driver_name() |
since |
string |
The first cPanel & WHM version with which the plugin is compatible. |
A valid string. |
cPanel & WHM version 11.32.4 |
abstract |
string |
A short description of the plugin. |
A valid string. |
An ExampleACL driver for developers to emulate. |
version |
string |
The ACL's version. |
Use the VERSION value from the ACL object module to supply this value. |
$Cpanel::Config::ConfigObj::Driver::ExampleACL::VERSION |