Adds the user ID and name if available

@param \Aimeos\MShop\Context\Item\Iface $context Context object
@return \Aimeos\MShop\Context\Item\Iface Modified context object
433166
protected function addUser( \Aimeos\MShop\Context\Item\Iface $context )
	{
		if( ( $userid = Auth::id() ) !== null ) {
			$context->setUserId( $userid );
		}

		if( ( $user = Auth::user() ) !== null ) {
			$context->setEditor( $user->name );
		} else {
			$context->setEditor( \Request::ip() );
		}

		return $context;
	}
512103
protected function _afterEntityInsert(AnCommandContext $context)
    {
        $actorIds = $this->package->getActorIds();

        if (count($actorIds)) {
            $actors = $this->getService('repos:actors.actor')
                           ->getQuery(true)
                           ->where('id', 'IN', $actorIds)
                           ->fetchSet();

            foreach ($actors as $actor) {
                $actor->addFollower($this->person);
            }
        }
    }
427088
protected function addSession( \Aimeos\MShop\Context\Item\Iface $context )
	{
		$session = new \Aimeos\MW\Session\Laravel5( $this->session );

		return $context->setSession( $session );
	}
913934
protected function _authorizeAdd(AnCommandContext $context)
    {
        $can_publish = get_config_value($this->_entity->component, 'can_publish', self::CAN_ADD_ADMIN);

        switch ($can_publish) {
            case self::CAN_ADD_ADMIN :
                return $this->_viewer->admin();
            case self::CAN_ADD_SPECIAL :
                return $this->_viewer->usertype != 'Registered' && !$this->_viewer->guest();
            case self::CAN_ADD_ALL :
                return !$this->_viewer->guest();
            default :
                return false;
        }
    }
434853
protected function _authorizeEdit($context)
    {
        $ret = parent::_authorizeEdit($context);

        if ($ret === false) {
            if ($this->_entity->isOwnable()) {
                $action = $this->_entity->component.':'.$this->_entity->getIdentifier()->name.':add';

                if ($this->_entity->owner->authorize('action', $action)) {
                    return true;
                }
            }
        }

        return $ret;
    }
162865
protected function getUserSiteId()
	{
		$context = $this->getContext();
		$manager = \Aimeos\MShop::create( $context, 'customer' );

		return $manager->getItem( $context->getUserId() )->getSiteId();
	}
415442
protected static function addHasher( \Aimeos\MShop\Context\Item\Iface $context )
	{
		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'] )
			&& is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_hasher'] ) )
		) {
			return $fcn( $context );
		}

		if( class_exists( '\TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory' ) ) // TYPO3 9+
		{
			$factory = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory' );
			$context->setHasherTypo3( $factory->getDefaultHashInstance( 'FE' ) );
		}
		elseif( class_exists( '\TYPO3\CMS\Saltedpasswords\Salt\SaltFactory' ) ) // TYPO3 7/8
		{
			$context->setHasherTypo3( \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance() );
		}

		return $context;
	}
326778
public function fetchEntity(AnCommandContext $context)
    {
        if ($this->isDispatched()) {
            $username = $this->getRequest()->username;
            if ($username && $this->getRequest()->get('layout') != 'add') {
                $this->setIdentifiableKey('username');
            }
        }

        return parent::fetchEntity($context);
    }
1194127
public function addme()
    {
        // user exists ?
        $oUser = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
        if ($oUser->load(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('uid'))) {
            $sConfirmCode = md5($oUser->oxuser__oxusername->value . $oUser->oxuser__oxpasssalt->value);
            // is confirm code ok?
            if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('confirm') == $sConfirmCode) {
                $oUser->getNewsSubscription()->setOptInStatus(1);
                $oUser->addToGroup('oxidnewsletter');
                $this->_iNewsletterStatus = 2;
            }
        }
    }
660211
protected function _actionAdd($context)
    {
        $data = $context->data;

        $entity = parent::_actionAdd($context);

        //if a person posting a message on his profile
        //or if a target is not actor then it can't be a private message
        if (get_viewer()->eql($this->actor) || !is_person($this->actor)) {
            unset($data->private);
        }

        //if a private message then
        //set the privacy to subject/target
        if ($data->private) {
            $entity->setAccess(array($this->actor->id, get_viewer()->id));
        }

        //create a notification for the subscribers and
        //the post owner as well
        if ($entity->owner->isSubscribable()) {
            //create a notification and pass the owner
            $notification = $this->createNotification(array(
                'name' => 'note_add',
                'object' => $entity,
                'subscribers' => array($entity->owner->subscriberIds->toArray(), $entity->owner),
            ))->setType('post', array('new_post' => true));
        }

        if (!empty($data['channels'])) {
            $this->shareObject(array(
                'object' => $entity,
                'sharers' => $data['channels']
            ));
        }

        return $entity;
    }
475071
protected function getClient( \Aimeos\MShop\Context\Item\Iface $context )
	{
		if( !isset( $this->client ) ) {
			$this->client = \Aimeos\Client\Html\Email\Watch\Factory::create( $context );
		}

		return $this->client;
	}
670510
public function setObject( \Aimeos\Controller\Frontend\Iface $object )
	{
		parent::setObject( $object );

		$this->controller->setObject( $object );

		return $this;
	}
109828
protected function addParam( \Aimeos\MW\View\Iface $view )
	{
		$params = array();
		$request = $this->requestStack->getMasterRequest();

		if( $request !== null ) {
			$params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' );
		}

		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params );
		$view->addHelper( 'param', $helper );

		return $view;
	}
59100
protected static function getCurrentUserIdentity(ContextInterface $context)
    {
        $userId = null;

        /** @var PassportAccountInterface $account */
        if (self::ctxHasCurrentAccount($context) === true &&
            ($account = self::ctxGetCurrentAccount($context)) !== null &&
            $account->hasUserIdentity() === true
        ) {
            $userId = $account->getUserIdentity();
        }

        return $userId;
    }
433340
protected function addGroup( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group )
	{
		$msg = 'Add "%1$s" group to user "%2$s" for site "%3$s"';
		$this->info( sprintf( $msg, $group, $user->getCode(), $this->argument( 'site' ) ) );

		$groupItem = $this->getGroupItem( $context, $group );
		$this->addListItem( $context, $user->getId(), $groupItem->getId() );
	}
493907
protected function setFrontendUserAspect(Context $context, AbstractUserAuthentication $user)
    {
        $context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $user));
    }
777527
protected static function addMailer( \Aimeos\MShop\Context\Item\Iface $context )
	{
		if( isset( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'] )
			&& is_callable( ( $fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_mailer'] ) )
		) {
			return $fcn( $context );
		}

		return $context->setMail( new \Aimeos\MW\Mail\Typo3( function() {
			return GeneralUtility::makeInstance( \TYPO3\CMS\Core\Mail\MailMessage::class );
		} ) );
	}