Commit f7307ef9 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

Use create function when admin approval

Also converts In2Code/User to MyProfile before sending to LDAP method
parent 20f814d4
Pipeline #3441 passed with stages
in 4 minutes and 26 seconds
......@@ -6,6 +6,8 @@ use TYPO3\CMS\Extbase\Persistence\Repository;
/**
* Class UserProfileRepository
*
* @method findByUid(int $uid) \T3o\T3omy\Domain\Model\MyProfile
*/
class MyProfileRepository extends Repository
{
......
......@@ -32,7 +32,6 @@ use In2code\Femanager\Controller\UserBackendController;
use In2code\Femanager\Domain\Model\User;
use In2code\Femanager\Domain\Service\SendMailService;
use In2code\Femanager\Utility\StringUtility;
use T3o\T3oLdap\Connectors\Ldap;
use T3o\T3oLdap\Utility\UserCreateUpdateDelete;
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -58,6 +57,12 @@ class FeManagerHooks
*/
protected $fullTS;
/**
* @var \T3o\T3omy\Domain\Repository\MyProfileRepository
* @inject
*/
protected $myProfileRepository;
/**
* DataHandlerHook constructor
......@@ -125,6 +130,7 @@ class FeManagerHooks
*/
public function newUserAdminApprovement(User $user, UserBackendController $plugin)
{
$this->createUser($user);
#User was approved via backend
$this->sendSlackBotMessage(
......@@ -168,7 +174,8 @@ class FeManagerHooks
*/
public function createUser(User $user)
{
$result = $this->ldapUserCreateUpdateDelete->updateUser($user);
$myProfileUser = $this->myProfileRepository->findByUid($user->getUid());
$result = $this->ldapUserCreateUpdateDelete->updateUser($myProfileUser);
// TODO: Create log entry if user has been successfully added or throw an exception otherwise
return $result;
......@@ -183,7 +190,8 @@ class FeManagerHooks
*/
public function updateUser(User $user)
{
$result = $this->ldapUserCreateUpdateDelete->updateUser($user);
$myProfileUser = $this->myProfileRepository->findByUid($user->getUid());
$result = $this->ldapUserCreateUpdateDelete->updateUser($myProfileUser);
// TODO: Create log entry if user has been successfully updated or throw an exception othwerwise
return $result;
......
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