Commit ffc563f6 authored by Markus Günther's avatar Markus Günther Committed by Christian Kuhn
Browse files

[TASK] Use extbase backend user model in ext:belog

Feature #39145 introduced a backend user model to extbase.
The patch uses this in the belog extension now and removes
the own implementation.

Change-Id: Id50ef8b58a86bc1af01be2ed3126f307649ef318
Fixes: #39452
Releases: 6.0
Reviewed-on: http://review.typo3.org/13416
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent 6de9228e
<?php
/***************************************************************
* Copyright notice
*
* (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Stub model for backend users - only properties required for belog module are added currently
*
* @TODO: This should be extended and put at some more central place
*
* @author Christian Kuhn <lolli@schwarzbu.ch>
* @package TYPO3
* @subpackage belog
*/
class Tx_Belog_Domain_Model_BackendUser extends Tx_Extbase_DomainObject_AbstractEntity {
/**
* name of the BE user
*
* @var string
*/
protected $username = '';
/**
* Set backend username
*
* @param string $username
* @return void
*/
public function setUsername($username) {
$this->username = $username;
}
/**
* Get backend username
*
* @return string
*/
public function getUsername() {
return $this->username;
}
}
?>
\ No newline at end of file
<?php
/***************************************************************
* Copyright notice
*
* (c) 2012 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Backend user repository
*
* @author Christian Kuhn <lolli@schwarzbu.ch>
* @package TYPO3
* @subpackage belog
*/
class Tx_Belog_Domain_Repository_BackendUserRepository extends Tx_Extbase_Persistence_Repository {
}
?>
\ No newline at end of file
......@@ -33,19 +33,10 @@
*/
class Tx_Belog_ViewHelpers_UsernameViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
/**
* @var Tx_Belog_Domain_Repository_BackendUserRepository
* @var Tx_Extbase_Domain_Repository_BackendUserRepository
* @inject
*/
protected $backendUserRepository = NULL;
/**
* Inject the backend user repository
*
* @param Tx_Belog_Domain_Repository_BackendUserRepository $backendUserRepository
* @return void
*/
public function injectBeUserRepository(Tx_Belog_Domain_Repository_BackendUserRepository $backendUserRepository) {
$this->backendUserRepository = $backendUserRepository;
}
protected $backendUserRepository;
/**
* Resolve user name from backend user id.
......@@ -54,13 +45,13 @@ class Tx_Belog_ViewHelpers_UsernameViewHelper extends Tx_Fluid_Core_ViewHelper_A
* @return string Username or an empty string if there is no user with that UID
*/
public function render($uid) {
/** @var $user Tx_Belog_Domain_Model_BackendUser */
/** @var $user Tx_Extbase_Domain_Model_BackendUser */
$user = $this->backendUserRepository->findByUid($uid);
if ($user === NULL) {
return '';
}
return $user->getUsername();
return $user->getUserName();
}
}
?>
\ No newline at end of file
?>
......@@ -22,11 +22,6 @@ module.tx_belog {
tableName = sys_workspace
}
}
Tx_Belog_Domain_Model_BackendUser {
mapping {
tableName = be_users
}
}
Tx_Belog_Domain_Model_HistoryEntry {
mapping {
tableName = sys_history
......
<?php
/***************************************************************
* Copyright notice
*
* (c) 2012 Oliver Klee <typo3-coding@oliverklee.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Testcase for the Tx_Belog_Domain_Repository_BackEndUserRepository class.
*
* @author Oliver Klee <typo3-coding@oliverklee.de>
* @package TYPO3
* @subpackage belog
*/
class Tx_Belog_Domain_Repository_BackendUserRepositoryTest extends Tx_Extbase_Tests_Unit_BaseTestCase {
public function setUp() {
$this->objectManager = $this->getMock('Tx_Extbase_Object_ObjectManagerInterface');
}
public function tearDown() {
unset($this->objectManager);
}
/**
* @test
*/
public function classCanBeInstantiated() {
}
/**
* @test
*/
public function initializeObjectSetsRespectStoragePidToFalse() {
$this->assertInstanceOf(
'Tx_Belog_Domain_Repository_BackendUserRepository',
new Tx_Belog_Domain_Repository_BackendUserRepository($this->objectManager)
);
}
}
?>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment