diff --git a/addons/authentication/authent.local.inc.php b/addons/authentication/authent.local.inc.php index 1cf8a244b..675c646cf 100644 --- a/addons/authentication/authent.local.inc.php +++ b/addons/authentication/authent.local.inc.php @@ -15,8 +15,8 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** - * AuthentNull - * User authentication Module, no password at all! + * Authent Local + * User authentication Module, password stored in the local database * * @author Erwan Taloc * @author Romain Quetiez diff --git a/addons/authentication/authent.nullpassword.inc.php b/addons/authentication/authent.nullpassword.inc.php new file mode 100644 index 000000000..a96f16db7 --- /dev/null +++ b/addons/authentication/authent.nullpassword.inc.php @@ -0,0 +1,78 @@ + + * @author Romain Quetiez + * @author Denis Flaven + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL + */ + + +class UserNullPassword extends User +{ + public static function Init() + { + $aParams = array + ( + "category" => "addon/authentication", + "key_type" => "autoincrement", + "name_attcode" => "login", + "state_attcode" => "", + "reconc_keys" => array(), + //"db_table" => "aaaaaaanullpassword", + "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) + { + return true; + } + + public function TrustWebServerContext() + { + return true; + } + + public function CanChangePassword() + { + return false; + } + + public function ChangePassword($sOldPassword, $sNewPassword) + { + return true; + } +} + + +?> diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 218bf40f8..a349e8815 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -761,6 +761,10 @@ abstract class DBObject private function DBInsertSingleTable($sTableClass) { + $sTable = MetaModel::DBGetTable($sTableClass); + // Abstract classes or classes having no specific attribute do not have an associated table + if ($sTable == '') return; + $sClass = get_class($this); // fields in first array, values in the second @@ -788,7 +792,6 @@ abstract class DBObject if (count($aValuesToWrite) == 0) return false; - $sTable = MetaModel::DBGetTable($sTableClass); $sInsertSQL = "INSERT INTO `$sTable` (".join(",", $aFieldsToWrite).") VALUES (".join(", ", $aValuesToWrite).")"; $iNewKey = CMDBSource::InsertInto($sInsertSQL); @@ -850,7 +853,6 @@ abstract class DBObject foreach(MetaModel::EnumParentClasses($sClass) as $sParentClass) { if ($sParentClass == $sRootClass) continue; - if (MetaModel::DBGetTable($sParentClass) == "") continue; $this->DBInsertSingleTable($sParentClass); } diff --git a/core/metamodel.class.php b/core/metamodel.class.php index a1664da28..9eee83caf 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -1727,7 +1727,7 @@ abstract class MetaModel // Then we join the queries of the eventual parent classes (compound model) foreach(self::EnumParentClasses($sClass) as $sParentClass) { - if (self::DBGetTable($sParentClass) == "") continue; + if (!self::HasTable($sParentClass)) continue; self::DbgTrace("Parent class: $sParentClass... let's call MakeQuerySingleTable()"); $oSelectParentTable = self::MakeQuerySingleTable($aSelectedClasses, $oConditionTree, $aClassAliases, $aTableAliases, $aTranslation, $oFilter, $sParentClass, $aExpectedAtts, $aExtKeys, $aValues); if (is_null($oSelectBase)) diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 40932896d..65ac93eed 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -98,7 +98,7 @@ abstract class User extends cmdbAbstractObject // 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 + MetaModel::Init_SetZListItems('list', array('finalclass', '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