Skip to content

Commit b9d8ffc

Browse files
merge magento/2.3.2-develop into magento-qwerty/MC-16089
2 parents 8e91f79 + b651a26 commit b9d8ffc

File tree

169 files changed

+4253
-1916
lines changed

Some content is hidden

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

169 files changed

+4253
-1916
lines changed

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Role extends \Magento\Framework\Model\AbstractModel
4040
* @param \Magento\Authorization\Model\ResourceModel\Role\Collection $resourceCollection
4141
* @param array $data
4242
*/
43-
public function __construct(
43+
public function __construct( //phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod
4444
\Magento\Framework\Model\Context $context,
4545
\Magento\Framework\Registry $registry,
4646
\Magento\Authorization\Model\ResourceModel\Role $resource,
@@ -52,28 +52,18 @@ public function __construct(
5252

5353
/**
5454
* @inheritDoc
55-
*
56-
* @SuppressWarnings(PHPMD.SerializationAware)
57-
* @deprecated Do not use PHP serialization.
5855
*/
5956
public function __sleep()
6057
{
61-
trigger_error('Using PHP serialization is deprecated', E_USER_DEPRECATED);
62-
6358
$properties = parent::__sleep();
6459
return array_diff($properties, ['_resource', '_resourceCollection']);
6560
}
6661

6762
/**
6863
* @inheritDoc
69-
*
70-
* @SuppressWarnings(PHPMD.SerializationAware)
71-
* @deprecated Do not use PHP serialization.
7264
*/
7365
public function __wakeup()
7466
{
75-
trigger_error('Using PHP serialization is deprecated', E_USER_DEPRECATED);
76-
7767
parent::__wakeup();
7868
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
7969
$this->_resource = $objectManager->get(\Magento\Authorization\Model\ResourceModel\Role::class);

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

Lines changed: 6 additions & 192 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,
@@ -192,6 +147,7 @@ public function isAllowed($resource, $privilege = null)
192147
return $acl->isAllowed($user->getAclRole(), null, $privilege);
193148
}
194149
} catch (\Exception $e) {
150+
return false;
195151
}
196152
}
197153
}
@@ -276,16 +232,6 @@ public function processLogin()
276232
return $this;
277233
}
278234

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

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)