Following things are changed: (in order of class names)
[shipsimu.git] / inc / classes / main / user / class_BaseUser.php
index 632f3ea393ea02d78adf01e2ac8cf90f079addba..e7e4541e70623d0dcaf99a6150777ece46fa41b7 100644 (file)
@@ -250,7 +250,7 @@ class BaseUser extends BaseFrameworkSystem {
         *
         * @return      $passHash       User's password hash from database result
         */
-       public function getPasswordHash () {
+       public final function getPasswordHash () {
                // Default is missing password hash
                $passHash = null;
 
@@ -274,7 +274,7 @@ class BaseUser extends BaseFrameworkSystem {
         * @return      $fieldValue             Field value from the user
         * @todo        Do we need to secure this here against missing results?
         */
-       public function getField ($fieldName) {
+       public final function getField ($fieldName) {
                // Default field value
                $fieldValue = null;
 
@@ -290,6 +290,25 @@ class BaseUser extends BaseFrameworkSystem {
                // Return it
                return $fieldValue;
        }
+
+       /**
+        * Getter for primary key value
+        *
+        * @return      $primaryValue   Value of the primary key based on database type
+        */
+       public final function getPrimaryKey () {
+               // Get a user database wrapper
+               $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+
+               // Get the primary key back from the wrapper
+               $primaryKey = $wrapperInstance->getPrimaryKeyValue();
+
+               // Get that field
+               $primaryValue = $this->getField($primaryKey);
+
+               // Return the value
+               return $primaryValue;
+       }
 }
 
 // [EOF]