Verified Commit b07b8641 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

🚜 feat(plugins) Adapt code to strict typing in core

issue #5921
parent 3f680c7f
......@@ -20,7 +20,7 @@
class mailAliasDistribution extends simplePlugin
{
public static function plInfo()
public static function plInfo (): array
{
return array(
'plShortName' => _('Temporary mail distribution'),
......@@ -38,29 +38,29 @@ class mailAliasDistribution extends simplePlugin
}
// The main function : information about attributes
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
'name' => _('Mail distribution'),
'attrs' => array(
new BaseSelectorAttribute (get_ou('aliasRDN')),
new HostNameAttribute (_('Name'), _('Name to identify this alias'), 'cn', TRUE),
new TextAreaAttribute (
new BaseSelectorAttribute(get_ou('aliasRDN')),
new HostNameAttribute(_('Name'), _('Name to identify this alias'), 'cn', TRUE),
new TextAreaAttribute(
_('Description'), _('Description of this alias'),
'description', FALSE
),
new MailAttribute (
new MailAttribute(
_('Email address'), _('Email address'),
'mail', TRUE
),
new SetAttribute(
new MailAttribute (
new MailAttribute(
_('Email aliases'), _('Aliases for this email address'),
'gosaMailAlternateAddress', TRUE
)
),
new SelectAttribute (
new SelectAttribute(
_('Mail server'), _('Mail server for this alias'),
'gosaMailServer', FALSE,
array_keys(mailMethod::getMailServers())
......
......@@ -20,7 +20,7 @@
class mailAliasRedirection extends simplePlugin
{
public static function plInfo()
public static function plInfo (): array
{
return array(
'plShortName' => _('Temporary mail redirection'),
......@@ -38,27 +38,27 @@ class mailAliasRedirection extends simplePlugin
}
// The main function : information about attributes
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
// Attributes are grouped by section
'main' => array(
'name' => _('Mail redirection'),
'attrs' => array(
new BaseSelectorAttribute (get_ou('aliasRDN')),
new HostNameAttribute (_('Name'), _('Name to identify this redirection'), 'cn', TRUE),
new TextAreaAttribute (
new BaseSelectorAttribute(get_ou('aliasRDN')),
new HostNameAttribute(_('Name'), _('Name to identify this redirection'), 'cn', TRUE),
new TextAreaAttribute(
_('Description'), _('Description of this redirection'),
'description', FALSE
),
new SetAttribute(
new MailAttribute (
new MailAttribute(
_('Redirect from'), _('Mail address from which you want to redirect'),
'mail', TRUE
)
),
new SetAttribute(
new MailAttribute (
new MailAttribute(
_('Redirect to'), _('Destination of this redirection'),
'gosaMailForwardingAddress', TRUE
)
......
......@@ -20,7 +20,7 @@
class aliasConfig extends simplePlugin
{
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Alias configuration'),
......@@ -33,13 +33,13 @@ class aliasConfig extends simplePlugin
);
}
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
'name' => _('Alias'),
'attrs' => array(
new StringAttribute (
new StringAttribute(
_('Alias RDN'), _('Branch in which aliases will be stored'),
'fdAliasRDN', TRUE,
'ou=alias'
......
......@@ -21,7 +21,7 @@
class application extends simplePlugin
{
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Application'),
......@@ -37,26 +37,26 @@ class application extends simplePlugin
);
}
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
'name' => _('Application'),
'attrs' => array(
new BaseSelectorAttribute(get_ou('applicationsRDN')),
new HostNameAttribute (
new HostNameAttribute(
_('Application name'), _('The name of this application'),
'cn', TRUE
),
new StringAttribute (
new StringAttribute(
_('Description'), _('A short description of this application'),
'description', FALSE
),
new StringAttribute (
new StringAttribute(
_('Execute'), _('The application to be executed'),
'fdApplicationExecutePath', TRUE
),
new StringAttribute (
new StringAttribute(
_('Display name'), _('The displayed name for this application'),
'fdApplicationTitle', FALSE
),
......@@ -65,7 +65,7 @@ class application extends simplePlugin
'icon' => array(
'name' => _('Icon'),
'attrs' => array(
new ImageAttribute (
new ImageAttribute(
'', _('The icon for this application'),
'fdApplicationImage', FALSE,
48, 48, 'png'
......
......@@ -20,7 +20,7 @@
class webApplication extends simplePlugin
{
public static function plInfo()
public static function plInfo (): array
{
return array(
'plShortName' => _('Web application'),
......@@ -36,26 +36,26 @@ class webApplication extends simplePlugin
);
}
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
'name' => _('Application'),
'attrs' => array(
new BaseSelectorAttribute (get_ou('webappsRDN')),
new HostNameAttribute (
new BaseSelectorAttribute(get_ou('webappsRDN')),
new HostNameAttribute(
_('Name'), _('Name or id for application'),
'cn', TRUE
),
new StringAttribute (
new StringAttribute(
_('Description'), _('A short description of this application'),
'description', FALSE
),
new URLAttribute (
new URLAttribute(
_('URL'), _('Link to this application'),
'labeledURI', TRUE
),
new StringAttribute (
new StringAttribute(
_('Display Name'), _('Displayed name for links to this application'),
'fdApplicationTitle', TRUE
),
......@@ -64,12 +64,12 @@ class webApplication extends simplePlugin
'icon' => array(
'name' => _('Icon'),
'attrs' => array(
new ImageAttribute (
new ImageAttribute(
'', _('The icon for this application'),
'fdApplicationImage', FALSE,
48, 48, 'png'
),
new StringAttribute (
new StringAttribute(
_('Icon location'), _('Usual path to this application icon'),
'fdApplicationImageLocation', FALSE
),
......
......@@ -22,7 +22,7 @@ class applicationRights extends simplePlugin
{
var $displayHeader = TRUE;
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Applications'),
......@@ -38,14 +38,14 @@ class applicationRights extends simplePlugin
);
}
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
'name' => _('Application list'),
'attrs' => array(
new SetAttribute (
new SelectAttribute (
new SetAttribute(
new SelectAttribute(
_('Applications'), _('The applications users with this role are allowed to launch'),
'fdApplicationAllowed', TRUE
)
......
......@@ -20,7 +20,7 @@
class applicationsPluginConfig extends simplePlugin
{
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Applications'),
......@@ -33,23 +33,23 @@ class applicationsPluginConfig extends simplePlugin
);
}
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'rdns' => array(
'name' => _('Applications'),
'attrs' => array(
new StringAttribute (
new StringAttribute(
_('Application RDN'), _('Branch in which applications will be stored'),
'fdApplicationsRDN', TRUE,
'ou=apps'
),
new StringAttribute (
new StringAttribute(
_('Web applications RDN'), _('Branch in which web applications will be stored'),
'fdWebappsRDN', TRUE,
'ou=apps'
),
new SelectAttribute (
new SelectAttribute(
_('Show web applications in menu'), _('Whether to show web applications in FD main menu'),
'fdWebappsMenu', TRUE,
array('none', 'allowed', 'all'), 'none',
......
......@@ -30,7 +30,7 @@ class MacsAttribute extends GenericDialogAttribute
class argonautAction extends simplePlugin
{
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Argonaut task'),
......@@ -45,7 +45,7 @@ class argonautAction extends simplePlugin
);
}
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
$events = argonautEventTypes::get_event_types();
return array(
......@@ -111,7 +111,7 @@ class argonautAction extends simplePlugin
);
}
public function __construct($action, array $targets, $scheduled)
public function __construct ($action, array $targets, $scheduled)
{
global $config;
parent::__construct($config->current['BASE']);
......@@ -152,7 +152,7 @@ class argonautAction extends simplePlugin
parent::loadAttributes();
}
function execute()
function execute (): string
{
return parent::execute().$this->getFooter();
}
......
......@@ -27,7 +27,7 @@ class argonautImportFile extends simplePlugin
'3' => 'OGROUP'
);
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Argonaut task import'),
......@@ -42,22 +42,22 @@ class argonautImportFile extends simplePlugin
);
}
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
'name' => _('Import actions from CSV file'),
'class' => array('fullwidth'),
'attrs' => array(
new CompositeAttribute (
new CompositeAttribute(
_('Import a list of task into argonaut'),
'import',
array(
new FileAttribute (
new FileAttribute(
'', '',
'import_file', FALSE
),
new ButtonAttribute (
new ButtonAttribute(
'', '',
'import_submit',
_('Upload')
......@@ -76,7 +76,7 @@ class argonautImportFile extends simplePlugin
);
}
public function __construct($parent)
public function __construct ($parent)
{
global $config;
parent::__construct($config->current['BASE'], NULL, $parent);
......@@ -88,7 +88,7 @@ class argonautImportFile extends simplePlugin
$this->daemon_events = argonautEventTypes::get_event_types();
}
function execute()
function execute (): string
{
$smarty = get_smarty();
$smarty->assign('jobtypes', join(',', array_keys($this->daemon_events)));
......@@ -104,7 +104,7 @@ class argonautImportFile extends simplePlugin
$this->parse_csv($this->import);
}
function save_object()
function save_object ()
{
/* Import started */
if (isset($_POST['start_import'])) {
......
......@@ -73,7 +73,7 @@ class ArgonautServiceNameAttribute extends CompositeAttribute
continue;
}
$value = (isset(static::$argonautService_defaults[$name]) ? static::$argonautService_defaults[$name] : "");
$this->attributes[$name] = new StringAttribute ($name, "Service $name",
$this->attributes[$name] = new StringAttribute($name, "Service $name",
"service_$name", FALSE,
$value, $this->getAcl());
}
......@@ -120,7 +120,7 @@ class argonautClient extends simplePlugin
var $inheritance = array('gosaGroupOfNames' => 'member');
static function plInfo ()
static function plInfo (): array
{
return array(
'plShortName' => _('Argonaut client'),
......@@ -133,33 +133,33 @@ class argonautClient extends simplePlugin
}
// The main function : information about attributes
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
'name' => _("Argonaut client settings"),
'attrs' => array(
new IntAttribute (
new IntAttribute(
_('Client port'), _('Port used by argonaut client for JSON-RPC'),
'argonautClientPort', TRUE,
0 /*min*/, FALSE /*no max*/, 8081 /*default value*/
),
new SelectAttribute (
new SelectAttribute(
_('Protocol'), _('Protocol to use for argonaut'),
'argonautClientProtocol', TRUE,
array('http', 'https')
),
new StringAttribute (
new StringAttribute(
_('WakeOnLan interface'), _('Interface used by argonaut for WakeOnLan'),
'argonautClientWakeOnLanInterface', TRUE,
'eth0'
),
new StringAttribute (
new StringAttribute(
_('TaskId file'), _('File which argonaut will use to store its task id when booting'),
'argonautTaskIdFile', TRUE,
'/tmp/argonaut'
),
new StringAttribute (
new StringAttribute(
_('Log directory'), _('Directory in which argonaut client should write its logs'),
'argonautClientLogDir', TRUE,
'/var/log/argonaut'
......@@ -169,22 +169,22 @@ class argonautClient extends simplePlugin
'ssl' => array (
'name' => _('SSL paths'),
'attrs' => array (
new TrimmedStringAttribute (
new TrimmedStringAttribute(
_('Key'), _('Path to the private key file on Argonaut client'),
'argonautClientKeyPath', FALSE,
'/etc/ssl/private/argonaut.key'
),
new TrimmedStringAttribute (
new TrimmedStringAttribute(
_('Certificate'), _('Path to the certificate file on Argonaut client'),
'argonautClientCertPath', FALSE,
'/etc/ssl/certs/argonaut.cert'
),
new TrimmedStringAttribute (
new TrimmedStringAttribute(
_('CA certificate'), _('Path to the CA certificate file on Argonaut client'),
'argonautClientCaCertPath', FALSE,
'/etc/ssl/certs/ca.cert'
),
new StringAttribute (
new StringAttribute(
_('CN of the certificate'), _('The CN in this client certificate'),
'argonautClientCertCN', FALSE
),
......@@ -193,7 +193,7 @@ class argonautClient extends simplePlugin
'serviceNames' => array(
'name' => _("Service names"),
'attrs' => array(
new ArgonautServiceNameAttribute (_("Argonaut service names"), "argonautServiceName"),
new ArgonautServiceNameAttribute(_("Argonaut service names"), "argonautServiceName"),
)
),
);
......
......@@ -24,7 +24,7 @@ class deploymentTimeframe extends simplePlugin
var $inheritance = array('gosaGroupOfNames' => 'member');
static function plInfo ()
static function plInfo (): array
{
return array(
'plShortName' => _('Deployment time frame'),
......@@ -37,7 +37,7 @@ class deploymentTimeframe extends simplePlugin
}
// The main function : information about attributes
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
return array(
'main' => array(
......@@ -48,11 +48,11 @@ class deploymentTimeframe extends simplePlugin
_('Time frames in which deployment is authorized'),
'argonautDeploymentTimeframe',
array(
new TimeHiAttribute (
new TimeHiAttribute(
'', _('Opening time for this frame as HH:MM'),
'begin', TRUE
),
new TimeHiAttribute (
new TimeHiAttribute(
_('->'), _('Closing time for this frame as HH:MM'),
'end', TRUE
)
......
......@@ -23,7 +23,7 @@ class argonautDNSConfig extends simpleService
protected static $showActions = FALSE;
/* Return plugin information for acl handling */
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Argonaut DNS settings'),
......@@ -39,7 +39,7 @@ class argonautDNSConfig extends simpleService
/*!
* \brief The main function : information about attributes
*/
static function getAttributesInfo ()
static function getAttributesInfo (): array
{
$zoneAttributeClass = 'StringAttribute';
if (class_available('ZoneNameAttribute')) {
......@@ -49,17 +49,17 @@ class argonautDNSConfig extends simpleService
'main' => array (
'name' => _('Ldap2zone global settings'),
'attrs' => array (
new StringAttribute (
new StringAttribute(
_('Bind directory'), _('The directory in which conf file must be created'),
'argonautLdap2zoneBindDir', TRUE,
'/etc/bind'
),
new StringAttribute (
new StringAttribute(
_('Bind cache directory'), _('The directory in which zone files must be created'),
'argonautLdap2zoneBindCacheDir', TRUE,
'/var/cache/bind'
),
new IntAttribute (
new IntAttribute(
_('TTL'),
_('Time to live'),
'argonautLdap2zoneTTL',
......@@ -68,14 +68,14 @@ class argonautDNSConfig extends simpleService
FALSE,
500
),
new StringAttribute (
new StringAttribute(
_('rndc path'),
_('path to rndc binary'),
'argonautLdap2zoneRndc',
FALSE,
'/usr/sbin/rndc'
),
new StringAttribute (
new StringAttribute(
_('Search base'), _('LDAP base in which ldap2zone should search. Only usefull if you got several nodes for the same zone.'),
'argonautLdap2zoneSearchBase', FALSE
),
......@@ -84,24 +84,24 @@ class argonautDNSConfig extends simpleService
'master' => array (
'name' => _('Ldap2zone master settings'),
'attrs' => array (
new BooleanAttribute (
new BooleanAttribute(
_('Ignore reverse zone'), _('Do not write reverse zone'),
'argonautLdap2zoneNoReverse', FALSE
),
new SelectAttribute (
new SelectAttribute(
_('Notify'), '',
'argonautLdap2zoneNotify', FALSE,
array('yes','no','explicit')
),
new StringAttribute (
new StringAttribute(
_('Allow update'), _('Allow update (semicolon separated and ended)'),
'argonautLdap2zoneAllowUpdate', FALSE
),
new StringAttribute (
new StringAttribute(
_('Allow transfer'), _('Allow transfer (semicolon separated and ended)'),
'argonautLdap2zoneAllowTransfer', FALSE
),
new SelectAttribute (
new SelectAttribute(
_('Check names'), _('Cause any host name for the zone to be checked for compliance with RFC 952 and RFC 1123 and take the defined action'),
'argonautLdap2zoneCheckNames', FALSE,
array('','warn','fail','ignore'), ''
......
......@@ -21,7 +21,7 @@
class argonautFuseConfig extends simpleService
{
static function plInfo()
static function plInfo (): array
{
return array(
'plShortName' => _('Argonaut Fuse'),
......@@ -36,20 +36,20 @@ class argonautFuseConfig extends simpleService
/*!
* \brief The main function : information about attributes