Commit 84a6a499 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

Merge branch 'add-create-user-command-for-admin-approval' into 'develop'

Use create function when admin approval

See merge request !21
parents 20f814d4 f7307ef9
Pipeline #3821 passed with stages
in 8 minutes and 16 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;
......
Markdown is supported
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