Skip to content

Commit 070abe4

Browse files
merge magento/2.3-develop into magento-tsg-csl3/2.3-develop-pr36
2 parents 905ed9b + 0c39cdb commit 070abe4

File tree

193 files changed

+5846
-1779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+5846
-1779
lines changed

app/code/Magento/Authorization/Model/Role.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ public function __construct( //phpcs:ignore Generic.CodeAnalysis.UselessOverridi
5252

5353
/**
5454
* @inheritDoc
55-
*
56-
* @SuppressWarnings(PHPMD.SerializationAware)
57-
* @deprecated Do not use PHP serialization.
5855
*/
5956
public function __sleep()
6057
{
@@ -64,9 +61,6 @@ public function __sleep()
6461

6562
/**
6663
* @inheritDoc
67-
*
68-
* @SuppressWarnings(PHPMD.SerializationAware)
69-
* @deprecated Do not use PHP serialization.
7064
*/
7165
public function __wakeup()
7266
{

app/code/Magento/Backend/Model/Auth/Session.php

Lines changed: 5 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@
55
*/
66
namespace Magento\Backend\Model\Auth;
77

8-
use Magento\Framework\Acl;
9-
use Magento\Framework\AclFactory;
10-
use Magento\Framework\App\ObjectManager;
118
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
129
use Magento\Framework\Stdlib\CookieManagerInterface;
13-
use Magento\Backend\Spi\SessionUserHydratorInterface;
14-
use Magento\Backend\Spi\SessionAclHydratorInterface;
15-
use Magento\User\Model\User;
16-
use Magento\User\Model\UserFactory;
1710

1811
/**
1912
* Backend Auth session model
2013
*
2114
* @api
15+
* @method \Magento\User\Model\User|null getUser()
16+
* @method \Magento\Backend\Model\Auth\Session setUser(\Magento\User\Model\User $value)
17+
* @method \Magento\Framework\Acl|null getAcl()
18+
* @method \Magento\Backend\Model\Auth\Session setAcl(\Magento\Framework\Acl $value)
2219
* @method int getUpdatedAt()
2320
* @method \Magento\Backend\Model\Auth\Session setUpdatedAt(int $value)
2421
*
@@ -59,36 +56,6 @@ class Session extends \Magento\Framework\Session\SessionManager implements \Mage
5956
*/
6057
protected $_config;
6158

62-
/**
63-
* @var SessionUserHydratorInterface
64-
*/
65-
private $userHydrator;
66-
67-
/**
68-
* @var SessionAclHydratorInterface
69-
*/
70-
private $aclHydrator;
71-
72-
/**
73-
* @var UserFactory
74-
*/
75-
private $userFactory;
76-
77-
/**
78-
* @var AclFactory
79-
*/
80-
private $aclFactory;
81-
82-
/**
83-
* @var User|null
84-
*/
85-
private $user;
86-
87-
/**
88-
* @var Acl|null
89-
*/
90-
private $acl;
91-
9259
/**
9360
* @param \Magento\Framework\App\Request\Http $request
9461
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
@@ -103,10 +70,6 @@ class Session extends \Magento\Framework\Session\SessionManager implements \Mage
10370
* @param \Magento\Backend\Model\UrlInterface $backendUrl
10471
* @param \Magento\Backend\App\ConfigInterface $config
10572
* @throws \Magento\Framework\Exception\SessionException
106-
* @param SessionUserHydratorInterface|null $userHydrator
107-
* @param SessionAclHydratorInterface|null $aclHydrator
108-
* @param UserFactory|null $userFactory
109-
* @param AclFactory|null $aclFactory
11073
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
11174
*/
11275
public function __construct(
@@ -121,19 +84,11 @@ public function __construct(
12184
\Magento\Framework\App\State $appState,
12285
\Magento\Framework\Acl\Builder $aclBuilder,
12386
\Magento\Backend\Model\UrlInterface $backendUrl,
124-
\Magento\Backend\App\ConfigInterface $config,
125-
?SessionUserHydratorInterface $userHydrator = null,
126-
?SessionAclHydratorInterface $aclHydrator = null,
127-
?UserFactory $userFactory = null,
128-
?AclFactory $aclFactory = null
87+
\Magento\Backend\App\ConfigInterface $config
12988
) {
13089
$this->_config = $config;
13190
$this->_aclBuilder = $aclBuilder;
13291
$this->_backendUrl = $backendUrl;
133-
$this->userHydrator = $userHydrator ?? ObjectManager::getInstance()->get(SessionUserHydratorInterface::class);
134-
$this->aclHydrator = $aclHydrator ?? ObjectManager::getInstance()->get(SessionAclHydratorInterface::class);
135-
$this->userFactory = $userFactory ?? ObjectManager::getInstance()->get(UserFactory::class);
136-
$this->aclFactory = $aclFactory ?? ObjectManager::getInstance()->get(AclFactory::class);
13792
parent::__construct(
13893
$request,
13994
$sidResolver,
@@ -277,16 +232,6 @@ public function processLogin()
277232
return $this;
278233
}
279234

280-
/**
281-
* @inheritDoc
282-
*/
283-
public function destroy(array $options = null)
284-
{
285-
$this->user = null;
286-
$this->acl = null;
287-
parent::destroy($options);
288-
}
289-
290235
/**
291236
* Process of configuring of current auth storage when logout was performed
292237
*
@@ -310,142 +255,4 @@ public function isValidForPath($path)
310255
{
311256
return true;
312257
}
313-
314-
/**
315-
* Logged-in user.
316-
*
317-
* @return User|null
318-
*/
319-
public function getUser()
320-
{
321-
if (!$this->user) {
322-
$userData = $this->getUserData();
323-
if ($userData) {
324-
/** @var User $user */
325-
$user = $this->userFactory->create();
326-
$this->userHydrator->hydrate($user, $userData);
327-
$this->user = $user;
328-
} elseif ($user = parent::getUser()) {
329-
$this->setUser($user);
330-
}
331-
}
332-
333-
return $this->user;
334-
}
335-
336-
/**
337-
* Set logged-in user instance.
338-
*
339-
* @param User|null $user
340-
* @return Session
341-
*/
342-
public function setUser($user)
343-
{
344-
$this->setUserData(null);
345-
if ($user) {
346-
$this->setUserData($this->userHydrator->extract($user));
347-
}
348-
$this->user = $user;
349-
350-
return $this;
351-
}
352-
353-
/**
354-
* Is user logged in?
355-
*
356-
* @return bool
357-
*/
358-
public function hasUser()
359-
{
360-
return (bool)$this->getUser();
361-
}
362-
363-
/**
364-
* Remove logged-in user.
365-
*
366-
* @return Session
367-
*/
368-
public function unsUser()
369-
{
370-
$this->user = null;
371-
parent::unsUser();
372-
return $this->unsUserData();
373-
}
374-
375-
/**
376-
* Logged-in user's ACL data.
377-
*
378-
* @return Acl|null
379-
*/
380-
public function getAcl()
381-
{
382-
if (!$this->acl) {
383-
$aclData = $this->getUserAclData();
384-
if ($aclData) {
385-
/** @var Acl $acl */
386-
$acl = $this->aclFactory->create();
387-
$this->aclHydrator->hydrate($acl, $aclData);
388-
$this->acl = $acl;
389-
} elseif ($acl = parent::getAcl()) {
390-
$this->setAcl($acl);
391-
}
392-
}
393-
394-
return $this->acl;
395-
}
396-
397-
/**
398-
* Set logged-in user's ACL data instance.
399-
*
400-
* @param Acl|null $acl
401-
* @return Session
402-
*/
403-
public function setAcl($acl)
404-
{
405-
$this->setUserAclData(null);
406-
if ($acl) {
407-
$this->setUserAclData($this->aclHydrator->extract($acl));
408-
}
409-
$this->acl = $acl;
410-
411-
return $this;
412-
}
413-
414-
/**
415-
* Whether ACL data is present.
416-
*
417-
* @return bool
418-
*/
419-
public function hasAcl()
420-
{
421-
return (bool)$this->getAcl();
422-
}
423-
424-
/**
425-
* Remove ACL data.
426-
*
427-
* @return Session
428-
*/
429-
public function unsAcl()
430-
{
431-
$this->acl = null;
432-
parent::unsAcl();
433-
return $this->unsUserAclData();
434-
}
435-
436-
/**
437-
* @inheritDoc
438-
*/
439-
public function writeClose()
440-
{
441-
//Updating data in session in case these objects has been changed.
442-
if ($this->user) {
443-
$this->setUser($this->user);
444-
}
445-
if ($this->acl) {
446-
$this->setAcl($this->acl);
447-
}
448-
449-
parent::writeClose();
450-
}
451258
}

app/code/Magento/Backend/Model/Auth/SessionAclHydrator.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

app/code/Magento/Backend/Model/Auth/SessionUserHydrator.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)