-
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.
CC-25813: Tech Debt for AclMerchantPortal module (#9927)
Tech Debt for AclMerchantPortal module
- Loading branch information
Showing
5 changed files
with
135 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"include": { | ||
"spryker/transfer": "Provides transfer objects definition with `::get*OrFail()` functionality." | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
...ale/Communication/Plugin/AclMerchantPortal/LocaleAclEntityConfigurationExpanderPlugin.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,53 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\Locale\Communication\Plugin\AclMerchantPortal; | ||
|
||
use Generated\Shared\Transfer\AclEntityMetadataConfigTransfer; | ||
use Generated\Shared\Transfer\AclEntityMetadataTransfer; | ||
use Spryker\Zed\AclMerchantPortalExtension\Dependency\Plugin\AclEntityConfigurationExpanderPluginInterface; | ||
use Spryker\Zed\Kernel\Communication\AbstractPlugin; | ||
|
||
/** | ||
* @method \Spryker\Zed\Locale\Business\LocaleFacadeInterface getFacade() | ||
* @method \Spryker\Zed\Locale\LocaleConfig getConfig() | ||
* @method \Spryker\Zed\Locale\Persistence\LocaleQueryContainerInterface getQueryContainer() | ||
* @method \Spryker\Zed\Locale\Communication\LocaleCommunicationFactory getFactory() | ||
*/ | ||
class LocaleAclEntityConfigurationExpanderPlugin extends AbstractPlugin implements AclEntityConfigurationExpanderPluginInterface | ||
{ | ||
/** | ||
* @uses {@link \Spryker\Shared\AclEntity\AclEntityConstants::OPERATION_MASK_READ} | ||
* | ||
* @var int | ||
*/ | ||
protected const OPERATION_MASK_READ = 0b1; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* - Expands provided `AclEntityMetadataConfig` transfer object with locale composite data. | ||
* | ||
* @api | ||
* | ||
* @param \Generated\Shared\Transfer\AclEntityMetadataConfigTransfer $aclEntityMetadataConfigTransfer | ||
* | ||
* @return \Generated\Shared\Transfer\AclEntityMetadataConfigTransfer | ||
*/ | ||
public function expand(AclEntityMetadataConfigTransfer $aclEntityMetadataConfigTransfer): AclEntityMetadataConfigTransfer | ||
{ | ||
$aclEntityMetadataConfigTransfer | ||
->getAclEntityMetadataCollectionOrFail() | ||
->addAclEntityMetadata( | ||
'Orm\Zed\Locale\Persistence\SpyLocale', | ||
(new AclEntityMetadataTransfer()) | ||
->setEntityName('Orm\Zed\Locale\Persistence\SpyLocale') | ||
->setDefaultGlobalOperationMask(static::OPERATION_MASK_READ), | ||
); | ||
|
||
return $aclEntityMetadataConfigTransfer; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...cale/Communication/Plugin/AclMerchantPortal/LocaleMerchantAclEntityRuleExpanderPlugin.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,55 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\Locale\Communication\Plugin\AclMerchantPortal; | ||
|
||
use Generated\Shared\Transfer\AclEntityRuleTransfer; | ||
use Spryker\Zed\AclMerchantPortalExtension\Dependency\Plugin\MerchantAclEntityRuleExpanderPluginInterface; | ||
use Spryker\Zed\Kernel\Communication\AbstractPlugin; | ||
|
||
/** | ||
* @method \Spryker\Zed\Locale\Business\LocaleFacadeInterface getFacade() | ||
* @method \Spryker\Zed\Locale\LocaleConfig getConfig() | ||
* @method \Spryker\Zed\Locale\Communication\LocaleCommunicationFactory getFactory() | ||
* @method \Spryker\Zed\Locale\Persistence\LocaleQueryContainerInterface getQueryContainer() | ||
*/ | ||
class LocaleMerchantAclEntityRuleExpanderPlugin extends AbstractPlugin implements MerchantAclEntityRuleExpanderPluginInterface | ||
{ | ||
/** | ||
* @uses {@link \Spryker\Shared\AclEntity\AclEntityConstants::SCOPE_GLOBAL} | ||
* | ||
* @var string | ||
*/ | ||
protected const SCOPE_GLOBAL = 'global'; | ||
|
||
/** | ||
* @uses {@link \Spryker\Shared\AclEntity\AclEntityConstants::OPERATION_MASK_READ} | ||
* | ||
* @var int | ||
*/ | ||
protected const OPERATION_MASK_READ = 0b1; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* - Expands set of `AclEntityRule` transfer objects with locale composite data. | ||
* | ||
* @api | ||
* | ||
* @param list<\Generated\Shared\Transfer\AclEntityRuleTransfer> $aclEntityRuleTransfers | ||
* | ||
* @return list<\Generated\Shared\Transfer\AclEntityRuleTransfer> | ||
*/ | ||
public function expand(array $aclEntityRuleTransfers): array | ||
{ | ||
$aclEntityRuleTransfers[] = (new AclEntityRuleTransfer()) | ||
->setEntity('Orm\Zed\Locale\Persistence\SpyLocale') | ||
->setScope(static::SCOPE_GLOBAL) | ||
->setPermissionMask(static::OPERATION_MASK_READ); | ||
|
||
return $aclEntityRuleTransfers; | ||
} | ||
} |