X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fuser%2Fclass_BaseUser.php;h=e7e4541e70623d0dcaf99a6150777ece46fa41b7;hp=632f3ea393ea02d78adf01e2ac8cf90f079addba;hb=6019ae86707cb6decaddc63f191e3ef6eb5e4d44;hpb=d527a312ec4b2983fc0ecda2179ce335c1a5a1f9 diff --git a/inc/classes/main/user/class_BaseUser.php b/inc/classes/main/user/class_BaseUser.php index 632f3ea..e7e4541 100644 --- a/inc/classes/main/user/class_BaseUser.php +++ b/inc/classes/main/user/class_BaseUser.php @@ -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]