added typeId for profile methods
This commit is contained in:
parent
ef1eec558a
commit
3a3c88ba4b
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,6 +54,9 @@ This is a list of API changes for all LAM releases.
|
||||||
<h2>5.7 -> 5.8</h2>
|
<h2>5.7 -> 5.8</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>All account types allow multiple configurations by default.</li>
|
<li>All account types allow multiple configurations by default.</li>
|
||||||
|
<li>check_profileOptions()/get_profileOptions() has new parameter $typeId<br>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<h2>5.6 -> 5.7</h2>
|
<h2>5.6 -> 5.7</h2>
|
||||||
|
|
|
@ -502,12 +502,13 @@ abstract class baseModule {
|
||||||
* and save profiles. We recommend to use the module name as prefix for them
|
* and save profiles. We recommend to use the module name as prefix for them
|
||||||
* (e.g. posixAccount_homeDirectory) to avoid naming conflicts.
|
* (e.g. posixAccount_homeDirectory) to avoid naming conflicts.
|
||||||
*
|
*
|
||||||
|
* @param string $typeId type id (user, group, host, ...)
|
||||||
* @return htmlElement meta HTML object
|
* @return htmlElement meta HTML object
|
||||||
*
|
*
|
||||||
* @see baseModule::get_metaData()
|
* @see baseModule::get_metaData()
|
||||||
* @see htmlElement
|
* @see htmlElement
|
||||||
*/
|
*/
|
||||||
public function get_profileOptions() {
|
public function get_profileOptions($typeId) {
|
||||||
if (isset($this->meta['profile_options'])) return $this->meta['profile_options'];
|
if (isset($this->meta['profile_options'])) return $this->meta['profile_options'];
|
||||||
else return array();
|
else return array();
|
||||||
}
|
}
|
||||||
|
@ -524,11 +525,12 @@ abstract class baseModule {
|
||||||
* the function returns an empty array.
|
* the function returns an empty array.
|
||||||
*
|
*
|
||||||
* @param array $options a hash array (name => value) containing the user input
|
* @param array $options a hash array (name => value) containing the user input
|
||||||
|
* @param string $typeId type id (user, group, host)
|
||||||
* @return array list of error messages (array(type, title, text)) to generate StatusMessages, if any
|
* @return array list of error messages (array(type, title, text)) to generate StatusMessages, if any
|
||||||
*
|
*
|
||||||
* @see baseModule::get_metaData()
|
* @see baseModule::get_metaData()
|
||||||
*/
|
*/
|
||||||
public function check_profileOptions($options) {
|
public function check_profileOptions($options, $typeId) {
|
||||||
$messages = array();
|
$messages = array();
|
||||||
if (isset($this->meta['profile_checks'])) {
|
if (isset($this->meta['profile_checks'])) {
|
||||||
$identifiers = array_keys($this->meta['profile_checks']);
|
$identifiers = array_keys($this->meta['profile_checks']);
|
||||||
|
|
|
@ -316,7 +316,7 @@ function getProfileOptions($typeId) {
|
||||||
$return = array();
|
$return = array();
|
||||||
for ($i = 0; $i < sizeof($mods); $i++) {
|
for ($i = 0; $i < sizeof($mods); $i++) {
|
||||||
$module = moduleCache::getModule($mods[$i], $type->getScope());
|
$module = moduleCache::getModule($mods[$i], $type->getScope());
|
||||||
$return[$mods[$i]] = $module->get_profileOptions();
|
$return[$mods[$i]] = $module->get_profileOptions($typeId);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -324,16 +324,18 @@ function getProfileOptions($typeId) {
|
||||||
/**
|
/**
|
||||||
* Checks if the profile options are valid
|
* Checks if the profile options are valid
|
||||||
*
|
*
|
||||||
* @param string $scope account type (user, group, host)
|
* @param string $typeId account type (user, group, host)
|
||||||
* @param array $options hash array containing all options (name => array(...))
|
* @param array $options hash array containing all options (name => array(...))
|
||||||
* @return array list of error messages
|
* @return array list of error messages
|
||||||
*/
|
*/
|
||||||
function checkProfileOptions($scope, $options) {
|
function checkProfileOptions($typeId, $options) {
|
||||||
$mods = $_SESSION['config']->get_AccountModules($scope);
|
$typeManager = new TypeManager();
|
||||||
|
$type = $typeManager->getConfiguredType($typeId);
|
||||||
|
$mods = $type->getModules();
|
||||||
$return = array();
|
$return = array();
|
||||||
for ($i = 0; $i < sizeof($mods); $i++) {
|
for ($i = 0; $i < sizeof($mods); $i++) {
|
||||||
$module = moduleCache::getModule($mods[$i], $scope);
|
$module = moduleCache::getModule($mods[$i], $type->getScope());
|
||||||
$temp = $module->check_profileOptions($options);
|
$temp = $module->check_profileOptions($options, $type->getId());
|
||||||
$return = array_merge($return, $temp);
|
$return = array_merge($return, $temp);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2011 - 2016 Roland Gruber
|
Copyright (C) 2011 - 2017 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -710,13 +710,10 @@ class freeRadius extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks input values of account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param array $options a hash array (name => value) containing the options
|
|
||||||
* @return array list of error messages (array(type, title, text)) to generate StatusMessages, if any
|
|
||||||
*/
|
*/
|
||||||
function check_profileOptions($options) {
|
function check_profileOptions($options, $typeId) {
|
||||||
$messages = parent::check_profileOptions($options);
|
$messages = parent::check_profileOptions($options, $typeId);
|
||||||
// group names
|
// group names
|
||||||
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusGroupName')) {
|
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusGroupName')) {
|
||||||
if (isset($options['freeRadius_radiusGroupName'][0]) && ($options['freeRadius_radiusGroupName'][0] != '')) {
|
if (isset($options['freeRadius_radiusGroupName'][0]) && ($options['freeRadius_radiusGroupName'][0] != '')) {
|
||||||
|
|
|
@ -2080,13 +2080,10 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks input values of account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param array $options a hash array (name => value) containing the options
|
|
||||||
* @return array list of error messages (array(type, title, text)) to generate StatusMessages, if any
|
|
||||||
*/
|
*/
|
||||||
function check_profileOptions($options) {
|
function check_profileOptions($options, $typeId) {
|
||||||
$messages = parent::check_profileOptions($options);
|
$messages = parent::check_profileOptions($options, $typeId);
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideTelephoneNumber')) {
|
||||||
$telephoneNumberList = preg_split('/;[ ]*/', $options['inetOrgPerson_telephoneNumber'][0]);
|
$telephoneNumberList = preg_split('/;[ ]*/', $options['inetOrgPerson_telephoneNumber'][0]);
|
||||||
for ($i = 0; $i < sizeof($telephoneNumberList); $i++) {
|
for ($i = 0; $i < sizeof($telephoneNumberList); $i++) {
|
||||||
|
|
|
@ -206,11 +206,9 @@ class nisNetGroupHost extends nisNetGroupUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return profile elements
|
|
||||||
*/
|
*/
|
||||||
function get_profileOptions() {
|
function get_profileOptions($typeId) {
|
||||||
$groups = $this->findGroups();
|
$groups = $this->findGroups();
|
||||||
$groupOptions = array('' => '');
|
$groupOptions = array('' => '');
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
|
|
|
@ -424,11 +424,9 @@ class nisNetGroupUser extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return profile elements
|
|
||||||
*/
|
*/
|
||||||
function get_profileOptions() {
|
function get_profileOptions($typeId) {
|
||||||
$groups = $this->findGroups();
|
$groups = $this->findGroups();
|
||||||
$groupOptions = array('' => '');
|
$groupOptions = array('' => '');
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
|
|
|
@ -1701,11 +1701,9 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return profile elements
|
|
||||||
*/
|
*/
|
||||||
function get_profileOptions() {
|
function get_profileOptions($typeId) {
|
||||||
$return = new htmlTable();
|
$return = new htmlTable();
|
||||||
$groupList = $this->findGroups();
|
$groupList = $this->findGroups();
|
||||||
$groups = array();
|
$groups = array();
|
||||||
|
|
|
@ -430,22 +430,10 @@ class puppetClient extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function defines what attributes will be used in the account profiles and their appearance in the profile editor.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* Calling this method does not require the existence of an enclosing {@link accountContainer}.<br>
|
|
||||||
* <br>
|
|
||||||
* The return value is an object implementing htmlElement.<br>
|
|
||||||
* The field name are used as keywords to load
|
|
||||||
* and save profiles. We recommend to use the module name as prefix for them
|
|
||||||
* (e.g. posixAccount_homeDirectory) to avoid naming conflicts.
|
|
||||||
*
|
|
||||||
* @return htmlElement meta HTML object
|
|
||||||
*
|
|
||||||
* @see baseModule::get_metaData()
|
|
||||||
* @see htmlElement
|
|
||||||
*/
|
*/
|
||||||
public function get_profileOptions() {
|
public function get_profileOptions($typeId) {
|
||||||
$return = parent::get_profileOptions();
|
$return = parent::get_profileOptions($typeId);
|
||||||
$possibleParentNodes = $this->getPossibleParentNodes();
|
$possibleParentNodes = $this->getPossibleParentNodes();
|
||||||
array_unshift($possibleParentNodes, '-');
|
array_unshift($possibleParentNodes, '-');
|
||||||
$possibleParentNodes = array_values($possibleParentNodes);
|
$possibleParentNodes = array_values($possibleParentNodes);
|
||||||
|
|
|
@ -467,11 +467,9 @@ class quota extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return htmlElement profile elements
|
|
||||||
*/
|
*/
|
||||||
function get_profileOptions() {
|
function get_profileOptions($typeId) {
|
||||||
$return = new htmlTable();
|
$return = new htmlTable();
|
||||||
$optionsAvailable = false;
|
$optionsAvailable = false;
|
||||||
// get list of lamdaemon servers
|
// get list of lamdaemon servers
|
||||||
|
@ -547,12 +545,9 @@ class quota extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks input values of account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param array $options a hash array (name => value) containing the options
|
|
||||||
* @return array list of error messages (array(type, title, text)) to generate StatusMessages, if any
|
|
||||||
*/
|
*/
|
||||||
function check_profileOptions($options) {
|
function check_profileOptions($options, $typeId) {
|
||||||
$return = array();
|
$return = array();
|
||||||
// get list of lamdaemon servers
|
// get list of lamdaemon servers
|
||||||
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
|
$lamdaemonServers = explode(";", $_SESSION['config']->get_scriptServers());
|
||||||
|
|
|
@ -561,11 +561,9 @@ class sambaGroupMapping extends baseModule {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return htmlElement profile elements
|
|
||||||
*/
|
*/
|
||||||
function get_profileOptions() {
|
function get_profileOptions($typeId) {
|
||||||
$return = new htmlTable();
|
$return = new htmlTable();
|
||||||
// get list of domains
|
// get list of domains
|
||||||
$sambaDomains = $this->getDomains();
|
$sambaDomains = $this->getDomains();
|
||||||
|
|
|
@ -4,7 +4,7 @@ $Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2003 - 2006 Tilo Lutz
|
Copyright (C) 2003 - 2006 Tilo Lutz
|
||||||
2005 - 2016 Roland Gruber
|
2005 - 2017 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1663,12 +1663,10 @@ class sambaSamAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return htmlElement profile elements
|
|
||||||
*/
|
*/
|
||||||
function get_profileOptions() {
|
function get_profileOptions($typeId) {
|
||||||
$return = parent::get_profileOptions();
|
$return = parent::get_profileOptions($typeId);
|
||||||
if ($this->get_scope() == 'user') {
|
if ($this->get_scope() == 'user') {
|
||||||
// lists for expiration date
|
// lists for expiration date
|
||||||
$day = array(); $mon = array(); $year = array();
|
$day = array(); $mon = array(); $year = array();
|
||||||
|
|
|
@ -317,13 +317,10 @@ class systemQuotas extends baseModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks input values of account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param array $options a hash array (name => value) containing the options
|
|
||||||
* @return array list of error messages (array(type, title, text)) to generate StatusMessages, if any
|
|
||||||
*/
|
*/
|
||||||
function check_profileOptions($options) {
|
function check_profileOptions($options, $typeId) {
|
||||||
$messages = parent::check_profileOptions($options);
|
$messages = parent::check_profileOptions($options, $typeId);
|
||||||
$quotas = explode(';', $options['systemQuotas_quota'][0]);
|
$quotas = explode(';', $options['systemQuotas_quota'][0]);
|
||||||
for ($q = 0; $q < sizeof($quotas); $q++) {
|
for ($q = 0; $q < sizeof($quotas); $q++) {
|
||||||
if ($quotas[$q] == '') {
|
if ($quotas[$q] == '') {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2013 - 2016 Roland Gruber
|
Copyright (C) 2013 - 2017 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2500,12 +2500,10 @@ class windowsUser extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of elements for the account profiles.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @return htmlElement profile elements
|
|
||||||
*/
|
*/
|
||||||
function get_profileOptions() {
|
function get_profileOptions($typeId) {
|
||||||
$return = parent::get_profileOptions();
|
$return = parent::get_profileOptions($typeId);
|
||||||
// domain
|
// domain
|
||||||
$domains = $this->getDomains();
|
$domains = $this->getDomains();
|
||||||
$domains[] = '';
|
$domains[] = '';
|
||||||
|
|
Loading…
Reference in New Issue