#166 Configuration by module (and module categories)

SVN:trunk[629]
This commit is contained in:
Romain Quetiez
2010-07-26 16:29:52 +00:00
parent c9a573e39f
commit 05c9b10546
18 changed files with 316 additions and 23 deletions

View File

@@ -0,0 +1,37 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// 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
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Localized data
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
?>

View File

@@ -0,0 +1,94 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// 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
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Authent LDAP
* User authentication Module, no password at all!
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
class UserLDAP extends User
{
public static function Init()
{
$aParams = array
(
"category" => "addon/authentication",
"key_type" => "autoincrement",
"name_attcode" => "login",
"state_attcode" => "",
"reconc_keys" => array(),
"db_table" => "",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
// Display lists
MetaModel::Init_SetZListItems('details', array('contactid', 'first_name', 'email', 'login', 'language', 'profile_list')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('first_name', 'last_name', 'login')); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid')); // Criteria of the std search form
MetaModel::Init_SetZListItems('advanced_search', array('login', 'contactid')); // Criteria of the advanced search form
}
public function CheckCredentials($sPassword)
{
$aLDAPConfig['host'] = MetaModel::GetModuleSetting('authent-ldap', 'host', 'localhost');
$aLDAPConfig['port'] = MetaModel::GetModuleSetting('authent-ldap', 'port', 389);
$aLDAPConfig['basedn'] = MetaModel::GetModuleSetting('authent-ldap', 'basedn', 'dc=net');
$ds = @ldap_connect($aLDAPConfig['host'], $aLDAPConfig['port']);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
$sDN = "uid=".$this->Get('login').",ou=people,".$aLDAPConfig['basedn'];
if ($bind = @ldap_bind($ds, $sDN, $sPassword))
{
return true;
}
else
{
return false;
}
}
public function TrustWebServerContext()
{
return false;
}
public function CanChangePassword()
{
return false;
}
public function ChangePassword($sOldPassword, $sNewPassword)
{
return false;
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'authent-ldap',
array(
// Identification
//
'label' => 'User authentication based on LDAP',
'category' => 'authentication',
// Setup
//
'dependencies' => array(
),
'mandatory' => false,
'visible' => true,
// Components
//
'datamodel' => array(
'model.authent-ldap.php',
),
'dictionary' => array(
'en.dict.authent-ldap.php',
),
'data.struct' => array(
//'data.struct.authent-ldap.xml',
),
'data.sample' => array(
//'data.sample.authent-ldap.xml',
),
// Documentation
//
'doc.manual_setup' => '',
'doc.more_information' => '',
// Default settings
//
'settings' => array(
'host' => '192.168.10.164',
'port' => 389,
'basedn' => 'dc=leconcorde,dc=net',
),
)
);
?>

View File

@@ -0,0 +1,37 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// 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
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Localized data
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
// Dictionnay conventions
// Class:<class_name>
// Class:<class_name>+
// Class:<class_name>/Attribute:<attribute_code>
// Class:<class_name>/Attribute:<attribute_code>+
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>
// Class:<class_name>/Attribute:<attribute_code>/Value:<value>+
// Class:<class_name>/Stimulus:<stimulus_code>
// Class:<class_name>/Stimulus:<stimulus_code>+
?>

View File

@@ -0,0 +1,101 @@
<?php
// Copyright (C) 2010 Combodo SARL
//
// 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
// the Free Software Foundation; version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/**
* Authent Local
* User authentication Module, password stored in the local database
*
* @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/
class UserLocal extends User
{
public static function Init()
{
$aParams = array
(
"category" => "addon/authentication",
"key_type" => "autoincrement",
"name_attcode" => "login",
"state_attcode" => "",
"reconc_keys" => array(),
"db_table" => "priv_user_local",
"db_key_field" => "id",
"db_finalclass_field" => "",
"display_template" => "",
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributePassword("password", array("allowed_values"=>null, "sql"=>"pwd", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
// Display lists
MetaModel::Init_SetZListItems('details', array('contactid', 'first_name', 'email', 'login', 'password', 'language', 'profile_list')); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('first_name', 'last_name', 'login')); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid')); // Criteria of the std search form
MetaModel::Init_SetZListItems('advanced_search', array('login', 'contactid')); // Criteria of the advanced search form
}
public function CheckCredentials($sPassword)
{
if ($this->Get('password') == $sPassword)
{
return true;
}
return false;
}
public function TrustWebServerContext()
{
return true;
}
public function CanChangePassword()
{
// For now everyone can change their password..
return true;
}
public function ChangePassword($sOldPassword, $sNewPassword)
{
if ($this->Get('password') == $sOldPassword)
{
$this->Set('password', $sNewPassword);
$oChange = MetaModel::NewObject("CMDBChange");
$oChange->Set("date", time());
if (UserRights::IsImpersonated())
{
$sUserString = Dict::Format('UI:Archive_User_OnBehalfOf_User', UserRights::GetRealUser(), UserRights::GetUser());
}
else
{
$sUserString = UserRights::GetUser();
}
$oChange->Set("userinfo", $sUserString);
$this->DBUpdateTracked($oChange);
return true;
}
return false;
}
}
?>

View File

@@ -0,0 +1,47 @@
<?php
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'authent-local',
array(
// Identification
//
'label' => 'User authentication based on the local DB',
'category' => 'authentication',
// Setup
//
'dependencies' => array(
),
'mandatory' => true,
'visible' => true,
// Components
//
'datamodel' => array(
'model.authent-local.php',
),
'dictionary' => array(
'en.dict.authent-local.php',
),
'data.struct' => array(
//'data.struct.authent-local.xml',
),
'data.sample' => array(
//'data.sample.authent-local.xml',
),
// Documentation
//
'doc.manual_setup' => '',
'doc.more_information' => '',
// Default settings
//
'settings' => array(
),
)
);
?>

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'iTop Basic Model',
'category' => 'business',
// Setup
//
@@ -35,6 +36,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '/doc/xxx/yyy.htm',
'doc.more_information' => '/doc/xxx/yyy.htm',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'Change Management',
'category' => 'business',
// Setup
//
@@ -38,6 +39,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '',
'doc.more_information' => '/doc/itop-documentation.htm#ChangeMgmt',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'Configuration Management (CMDB)',
'category' => 'business',
// Setup
//
@@ -49,6 +50,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '', // No manual installation required
'doc.more_information' => '/doc/itop-documentation.htm#ConfigMgmt',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'Incident Management',
'category' => 'business',
// Setup
//
@@ -39,6 +40,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '',
'doc.more_information' => '/doc/itop-documentation.htm#IncidentMgmt',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'Known Errors Database',
'category' => 'business',
// Setup
//
@@ -38,6 +39,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '', // No manual installation instructions
'doc.more_information' => '/doc/itop-documentation.htm#KnownErrorsDB',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'Problem Management',
'category' => 'business',
// Setup
//
@@ -38,6 +39,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '', // No manual installation instructions
'doc.more_information' => '/doc/itop-documentation.htm#ProblemMgmt',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'User request management (Service Desk)',
'category' => 'business',
// Setup
//
@@ -38,6 +39,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '',
'doc.more_information' => '/doc/itop-documentation.htm#RequestMgmt',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'Service Management (services, SLAs, contracts)',
'category' => 'business',
// Setup
//
@@ -43,6 +44,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '', // No manual installation instructions
'doc.more_information' => '/doc/itop-documentation.htm#ServiceMgmt',
// Default settings
//
'settings' => array(
),
)
);

View File

@@ -8,6 +8,7 @@ SetupWebPage::AddModule(
// Identification
//
'label' => 'Tickets - prerequisite for ticket modules',
'category' => 'business',
// Setup
//
@@ -35,6 +36,11 @@ SetupWebPage::AddModule(
//
'doc.manual_setup' => '',
'doc.more_information' => '',
// Default settings
//
'settings' => array(
),
)
);