|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
| 5 | + * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
| 6 | + */ |
| 7 | + |
| 8 | +namespace Spryker\Zed\UserPasswordReset\Communication\Plugin\AclMerchantPortal; |
| 9 | + |
| 10 | +use Generated\Shared\Transfer\AclEntityMetadataConfigTransfer; |
| 11 | +use Generated\Shared\Transfer\AclEntityMetadataTransfer; |
| 12 | +use Spryker\Zed\AclMerchantPortalExtension\Dependency\Plugin\AclEntityConfigurationExpanderPluginInterface; |
| 13 | +use Spryker\Zed\Kernel\Communication\AbstractPlugin; |
| 14 | + |
| 15 | +/** |
| 16 | + * @method \Spryker\Zed\UserPasswordReset\Business\UserPasswordResetFacadeInterface getFacade() |
| 17 | + * @method \Spryker\Zed\UserPasswordReset\UserPasswordResetConfig getConfig() |
| 18 | + */ |
| 19 | +class UserPasswordResetAclEntityConfigurationExpanderPlugin extends AbstractPlugin implements AclEntityConfigurationExpanderPluginInterface |
| 20 | +{ |
| 21 | + /** |
| 22 | + * @uses {@link \Spryker\Shared\AclEntity\AclEntityConstants::OPERATION_MASK_READ} |
| 23 | + * |
| 24 | + * @var int |
| 25 | + */ |
| 26 | + protected const OPERATION_MASK_READ = 0b1; |
| 27 | + |
| 28 | + /** |
| 29 | + * @uses {@link \Spryker\Shared\AclEntity\AclEntityConstants::OPERATION_MASK_CREATE} |
| 30 | + * |
| 31 | + * @var int |
| 32 | + */ |
| 33 | + protected const OPERATION_MASK_CREATE = 0b10; |
| 34 | + |
| 35 | + /** |
| 36 | + * @uses {@link \Spryker\Shared\AclEntity\AclEntityConstants::OPERATION_MASK_UPDATE} |
| 37 | + * |
| 38 | + * @var int |
| 39 | + */ |
| 40 | + protected const OPERATION_MASK_UPDATE = 0b100; |
| 41 | + |
| 42 | + /** |
| 43 | + * {@inheritDoc} |
| 44 | + * - Expands provided `AclEntityMetadataConfig` transfer object with user password reset composite data. |
| 45 | + * |
| 46 | + * @api |
| 47 | + * |
| 48 | + * @param \Generated\Shared\Transfer\AclEntityMetadataConfigTransfer $aclEntityMetadataConfigTransfer |
| 49 | + * |
| 50 | + * @return \Generated\Shared\Transfer\AclEntityMetadataConfigTransfer |
| 51 | + */ |
| 52 | + public function expand(AclEntityMetadataConfigTransfer $aclEntityMetadataConfigTransfer): AclEntityMetadataConfigTransfer |
| 53 | + { |
| 54 | + $aclEntityMetadataConfigTransfer |
| 55 | + ->getAclEntityMetadataCollectionOrFail() |
| 56 | + ->addAclEntityMetadata( |
| 57 | + 'Orm\Zed\UserPasswordReset\Persistence\SpyResetPassword', |
| 58 | + (new AclEntityMetadataTransfer()) |
| 59 | + ->setEntityName('Orm\Zed\UserPasswordReset\Persistence\SpyResetPassword') |
| 60 | + ->setDefaultGlobalOperationMask(static::OPERATION_MASK_CREATE | static::OPERATION_MASK_READ | static::OPERATION_MASK_UPDATE), |
| 61 | + ); |
| 62 | + |
| 63 | + return $aclEntityMetadataConfigTransfer; |
| 64 | + } |
| 65 | +} |
0 commit comments