/** * Return (or create, assuming no external auth backend) a user based on * a provided openid identity * * @param string $identity * * @return \thebuggenie\core\entities\User */ public static function getByOpenID($identity) { $user = null; if ($user_id = tables\OpenIdAccounts::getTable()->getUserIDfromIdentity($identity)) { $user = \thebuggenie\core\entities\User::getB2DBTable()->selectById($user_id); } elseif (!framework\Settings::isUsingExternalAuthenticationBackend() && framework\Settings::getOpenIDStatus() == 'all') { $user = new self(); $user->setPassword(self::createPassword()); $user->setUsername(self::createPassword() . self::createPassword()); $user->setOpenIdLocked(); $user->setActivated(); $user->setEnabled(); $user->setValidated(); $user->save(); } return $user; }