PHP code example of 3brs / sylius-enterprise-security-plugin

1. Go to this page and download the library: Download 3brs/sylius-enterprise-security-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

3brs / sylius-enterprise-security-plugin example snippets


   return [
       // ...
       Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true],
       ThreeBRS\EnterpriseSecurityBundle\ThreeBRSEnterpriseSecurityBundle::class => ['all' => true],
       ThreeBRS\SyliusEnterpriseSecurityPlugin\ThreeBRSSyliusEnterpriseSecurityPlugin::class => ['all' => true],
   ];
   

   // src/Entity/User/ShopUser.php
   use Doctrine\ORM\Mapping as ORM;
   use Sylius\Component\Core\Model\ShopUser as BaseShopUser;
   use ThreeBRS\EnterpriseSecurityBundle\Lockout\LockableShopUserInterface;
   use ThreeBRS\EnterpriseSecurityBundle\PasswordExpiration\PasswordExpirationShopUserInterface;
   use ThreeBRS\EnterpriseSecurityBundle\TwoFactor\TwoFactorAuthShopUserInterface;
   use ThreeBRS\SyliusEnterpriseSecurityPlugin\Model\LockableShopUserTrait;
   use ThreeBRS\SyliusEnterpriseSecurityPlugin\Model\PasswordExpirationShopUserTrait;
   use ThreeBRS\SyliusEnterpriseSecurityPlugin\Model\TwoFactorAuthShopUserTrait;

   #[ORM\Entity]
   #[ORM\Table(name: 'sylius_shop_user')]
   class ShopUser extends BaseShopUser implements PasswordExpirationShopUserInterface, TwoFactorAuthShopUserInterface, LockableShopUserInterface
   {
       use PasswordExpirationShopUserTrait;
       use TwoFactorAuthShopUserTrait;
       use LockableShopUserTrait;
   }
   

   // src/Entity/User/AdminUser.php
   use Doctrine\ORM\Mapping as ORM;
   use Sylius\Component\Core\Model\AdminUser as BaseAdminUser;
   use ThreeBRS\EnterpriseSecurityBundle\Lockout\LockableAdminUserInterface;
   use ThreeBRS\EnterpriseSecurityBundle\PasswordExpiration\PasswordExpirationAdminUserInterface;
   use ThreeBRS\EnterpriseSecurityBundle\TwoFactor\TwoFactorAuthAdminUserInterface;
   use ThreeBRS\SyliusEnterpriseSecurityPlugin\Model\LockableAdminUserTrait;
   use ThreeBRS\SyliusEnterpriseSecurityPlugin\Model\PasswordExpirationAdminUserTrait;
   use ThreeBRS\SyliusEnterpriseSecurityPlugin\Model\TwoFactorAuthAdminUserTrait;

   #[ORM\Entity]
   #[ORM\Table(name: 'sylius_admin_user')]
   class AdminUser extends BaseAdminUser implements PasswordExpirationAdminUserInterface, TwoFactorAuthAdminUserInterface, LockableAdminUserInterface
   {
       use PasswordExpirationAdminUserTrait;
       use TwoFactorAuthAdminUserTrait;
       use LockableAdminUserTrait;
   }