forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.3-qwerty' of github.com:magento/magento2ce into MC-13900
- Loading branch information
Showing
363 changed files
with
7,511 additions
and
2,959 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
app/code/Magento/Backend/Model/Auth/SessionAclHydrator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Backend\Model\Auth; | ||
|
||
use Magento\Backend\Spi\SessionAclHydratorInterface; | ||
use Magento\Framework\Acl; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
class SessionAclHydrator extends Acl implements SessionAclHydratorInterface | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function extract(Acl $acl): array | ||
{ | ||
return ['rules' => $acl->_rules, 'resources' => $acl->_resources, 'roles' => $acl->_roleRegistry]; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function hydrate(Acl $target, array $data): void | ||
{ | ||
$target->_rules = $data['rules']; | ||
$target->_resources = $data['resources']; | ||
$target->_roleRegistry = $data['roles']; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
app/code/Magento/Backend/Model/Auth/SessionUserHydrator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Backend\Model\Auth; | ||
|
||
use Magento\Backend\Spi\SessionUserHydratorInterface; | ||
use Magento\User\Model\User; | ||
use Magento\Authorization\Model\Role; | ||
use Magento\Authorization\Model\RoleFactory; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
class SessionUserHydrator implements SessionUserHydratorInterface | ||
{ | ||
/** | ||
* @var RoleFactory | ||
*/ | ||
private $roleFactory; | ||
|
||
/** | ||
* @param RoleFactory $roleFactory | ||
*/ | ||
public function __construct(RoleFactory $roleFactory) | ||
{ | ||
$this->roleFactory = $roleFactory; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function extract(User $user): array | ||
{ | ||
return ['data' => $user->getData(), 'role_data' => $user->getRole()->getData()]; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function hydrate(User $target, array $data): void | ||
{ | ||
$target->setData($data['data']); | ||
/** @var Role $role */ | ||
$role = $this->roleFactory->create(); | ||
$role->setData($data['role_data']); | ||
$target->setData('extracted_role', $role); | ||
$target->getRole(); | ||
} | ||
} |
Oops, something went wrong.