public function testUpdateDisplayName() { DB::updateDisplayName(self::$userY['LoginName'], self::$userZ['DisplayName']); $displayName = DB::getDisplayName(self::$userY['LoginName']); $this->assertEquals($displayName, self::$userZ['DisplayName']); $outcome = DB::updateDisplayName(self::$userY['LoginName'], self::$userY['DisplayName']); //undo change $this->assertTrue($outcome); }
if ($loginName) { //user is internal, backends are enabled, and user mapping is active $adapter->initializeUser($loginName); } else { //user is external //crop $mail to fit into display_name column of oc_shibboleth_user if (strlen($mail) > 64) { $mail = substr($mail, 0, 64); } //make sure that user entry exists in oc_shibboleth_user $loginName = \OCA\user_shibboleth\LoginLib::persistentId2LoginName($persistentId); $displayName = $mail; if (\OCA\user_shibboleth\DB::loginNameExists($loginName)) { //update display name if it has changed since last login if ($displayName !== \OCA\user_shibboleth\DB::getDisplayName($loginName)) { \OCA\user_shibboleth\DB::updateDisplayName($loginName, $displayName); } } else { //create a new user account $homeDir = \OCA\user_shibboleth\LoginLib::getHomeDirPath($loginName); \OCA\user_shibboleth\DB::addUser($loginName, $displayName, $homeDir); } } //perform OC login \OC_User::login($loginName, 'irrelevant'); \OCP\Util::writeLog('user_shibboleth', 'Login ' . $loginName, \OCP\Util::DEBUG); } else { //not authenticated, yet //follow shibboleth authentication procedure $location = $sessionsHandlerUrl . $sessionInitiatorLocation . '?target=' . \OCA\user_shibboleth\LoginLib::getForwardingPageUrl(); }