vendor/dachcom-digital/members/src/MembersBundle/DependencyInjection/Configuration.php line 22

Open in your IDE?
  1. <?php
  2. namespace MembersBundle\DependencyInjection;
  3. use MembersBundle\Form\Type\ChangePasswordFormType;
  4. use MembersBundle\Form\Type\Sso\CompleteProfileFormType;
  5. use MembersBundle\Form\Type\DeleteAccountFormType;
  6. use MembersBundle\Form\Type\ProfileFormType;
  7. use MembersBundle\Form\Type\RegistrationFormType;
  8. use MembersBundle\Form\Type\LoginFormType;
  9. use MembersBundle\Form\Type\ResettingFormType;
  10. use MembersBundle\Form\Type\ResettingRequestFormType;
  11. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  12. use Symfony\Component\Config\Definition\ConfigurationInterface;
  13. class Configuration implements ConfigurationInterface
  14. {
  15.     public function getConfigTreeBuilder()
  16.     {
  17.         $validPostRegisterTypes = ['confirm_by_mail''confirm_by_admin''confirm_instant'];
  18.         $treeBuilder = new TreeBuilder();
  19.         $rootNode $treeBuilder->root('members');
  20.         $rootNode
  21.             ->children()
  22.                 ->booleanNode('send_admin_mail_after_register')->defaultFalse()->end()
  23.                 ->booleanNode('send_user_mail_after_confirmed')->defaultFalse()->end()
  24.                 ->enumNode('post_register_type')
  25.                     ->values($validPostRegisterTypes)
  26.                     ->defaultValue('confirm_by_mail')
  27.                 ->end()
  28.                 ->enumNode('post_register_type_oauth')
  29.                     ->values($validPostRegisterTypes)
  30.                     ->defaultValue('confirm_instant')
  31.                 ->end()
  32.                 ->scalarNode('storage_path')->cannotBeEmpty()->defaultValue('/members')->end()
  33.                 ->arrayNode('oauth')
  34.                     ->addDefaultsIfNotSet()
  35.                     ->children()
  36.                         ->booleanNode('enabled')->defaultFalse()->end()
  37.                         ->enumNode('activation_type')
  38.                             ->values(['complete_profile''instant'])
  39.                             ->defaultValue('complete_profile')
  40.                         ->end()
  41.                         ->booleanNode('clean_up_expired_tokens')->defaultFalse()->end()
  42.                         ->integerNode('expired_tokens_ttl')->defaultValue(0)->min(0)->end()
  43.                         ->arrayNode('scopes')
  44.                             ->useAttributeAsKey('client')
  45.                             ->prototype('array')
  46.                                 ->prototype('scalar')->end()
  47.                             ->end()
  48.                         ->end()
  49.                     ->end()
  50.                 ->end()
  51.                 ->arrayNode('user')
  52.                     ->addDefaultsIfNotSet()
  53.                     ->children()
  54.                         ->arrayNode('adapter')
  55.                             ->addDefaultsIfNotSet()
  56.                             ->children()
  57.                                 ->scalarNode('class_name')->defaultValue('MembersUser')->end()
  58.                             ->end()
  59.                         ->end()
  60.                         ->arrayNode('initial_groups')
  61.                             ->prototype('scalar')->defaultValue([])->end()
  62.                             ->validate()
  63.                                 ->ifEmpty()
  64.                                 ->thenEmptyArray()
  65.                             ->end()
  66.                         ->end()
  67.                     ->end()
  68.                 ->end()
  69.                 ->arrayNode('group')
  70.                     ->addDefaultsIfNotSet()
  71.                     ->children()
  72.                         ->arrayNode('adapter')
  73.                             ->addDefaultsIfNotSet()
  74.                             ->children()
  75.                                 ->scalarNode('class_name')->defaultValue('MembersGroup')->end()
  76.                             ->end()
  77.                         ->end()
  78.                     ->end()
  79.                 ->end()
  80.                 ->arrayNode('sso')
  81.                     ->addDefaultsIfNotSet()
  82.                     ->children()
  83.                         ->arrayNode('adapter')
  84.                             ->addDefaultsIfNotSet()
  85.                             ->children()
  86.                                 ->scalarNode('class_name')->defaultValue('SsoIdentity')->end()
  87.                             ->end()
  88.                         ->end()
  89.                     ->end()
  90.                 ->end()
  91.                 ->arrayNode('auth')
  92.                     ->addDefaultsIfNotSet()
  93.                     ->children()
  94.                         ->arrayNode('adapter')
  95.                             ->addDefaultsIfNotSet()
  96.                             ->children()
  97.                                 ->scalarNode('class_name')->defaultNull()->end()
  98.                                 ->scalarNode('object_path')->defaultNull()->end()
  99.                             ->end()
  100.                         ->end()
  101.                     ->end()
  102.                 ->end()
  103.                 ->arrayNode('restriction')
  104.                     ->addDefaultsIfNotSet()
  105.                     ->children()
  106.                         ->booleanNode('enabled')->defaultFalse()->end()
  107.                         ->arrayNode('allowed_objects')
  108.                             ->prototype('scalar')->end()
  109.                             ->validate()
  110.                                 ->ifEmpty()
  111.                                 ->thenEmptyArray()
  112.                             ->end()
  113.                         ->end()
  114.                     ->end()
  115.                 ->end()
  116.                 ->arrayNode('relations')
  117.                     ->addDefaultsIfNotSet()
  118.                     ->children()
  119.                         ->arrayNode('login')
  120.                             ->addDefaultsIfNotSet()
  121.                             ->canBeUnset()
  122.                             ->children()
  123.                                 ->arrayNode('form')
  124.                                     ->addDefaultsIfNotSet()
  125.                                     ->children()
  126.                                         ->scalarNode('type')->defaultValue(LoginFormType::class)->end()
  127.                                         ->scalarNode('name')->defaultValue('members_user_login_form')->end()
  128.                                         ->arrayNode('validation_groups')
  129.                                             ->prototype('scalar')->end()
  130.                                             ->defaultValue(['Login''Default'])
  131.                                         ->end()
  132.                                     ->end()
  133.                                 ->end()
  134.                             ->end()
  135.                         ->end()
  136.                         ->arrayNode('profile')
  137.                             ->addDefaultsIfNotSet()
  138.                             ->canBeUnset()
  139.                             ->children()
  140.                                 ->arrayNode('form')
  141.                                     ->addDefaultsIfNotSet()
  142.                                     ->children()
  143.                                         ->scalarNode('type')->defaultValue(ProfileFormType::class)->end()
  144.                                         ->scalarNode('name')->defaultValue('members_user_profile_form')->end()
  145.                                         ->arrayNode('validation_groups')
  146.                                             ->prototype('scalar')->end()
  147.                                             ->defaultValue(['Profile''Default'])
  148.                                         ->end()
  149.                                     ->end()
  150.                                 ->end()
  151.                             ->end()
  152.                         ->end()
  153.                         ->arrayNode('change_password')
  154.                             ->addDefaultsIfNotSet()
  155.                             ->canBeUnset()
  156.                                 ->children()
  157.                                     ->arrayNode('form')
  158.                                     ->addDefaultsIfNotSet()
  159.                                     ->children()
  160.                                         ->scalarNode('type')->defaultValue(ChangePasswordFormType::class)->end()
  161.                                         ->scalarNode('name')->defaultValue('members_user_change_password_form')->end()
  162.                                         ->arrayNode('validation_groups')
  163.                                             ->prototype('scalar')->end()
  164.                                             ->defaultValue(['ChangePassword''Default'])
  165.                                         ->end()
  166.                                     ->end()
  167.                                 ->end()
  168.                             ->end()
  169.                         ->end()
  170.                         ->arrayNode('registration')
  171.                             ->addDefaultsIfNotSet()
  172.                             ->canBeUnset()
  173.                                 ->children()
  174.                                     ->arrayNode('form')
  175.                                     ->addDefaultsIfNotSet()
  176.                                         ->children()
  177.                                             ->scalarNode('type')->defaultValue(RegistrationFormType::class)->end()
  178.                                             ->scalarNode('name')->defaultValue('members_user_registration_form')->end()
  179.                                             ->arrayNode('validation_groups')
  180.                                                 ->prototype('scalar')->end()
  181.                                                 ->defaultValue(['Registration''Default'])
  182.                                         ->end()
  183.                                     ->end()
  184.                                 ->end()
  185.                             ->end()
  186.                         ->end()
  187.                         ->arrayNode('resetting_request')
  188.                             ->addDefaultsIfNotSet()
  189.                             ->canBeUnset()
  190.                                 ->children()
  191.                                     ->arrayNode('form')
  192.                                     ->addDefaultsIfNotSet()
  193.                                         ->children()
  194.                                         ->scalarNode('type')->defaultValue(ResettingRequestFormType::class)->end()
  195.                                         ->scalarNode('name')->defaultValue('members_user_resetting_request_form')->end()
  196.                                         ->arrayNode('validation_groups')
  197.                                             ->prototype('scalar')->end()
  198.                                             ->defaultValue(['ResetPassword''Default'])
  199.                                         ->end()
  200.                                     ->end()
  201.                                 ->end()
  202.                             ->end()
  203.                         ->end()
  204.                         ->arrayNode('resetting')
  205.                             ->addDefaultsIfNotSet()
  206.                             ->canBeUnset()
  207.                                 ->children()
  208.                                     ->scalarNode('retry_ttl')->defaultValue(7200)->end()
  209.                                     ->scalarNode('token_ttl')->defaultValue(86400)->end()
  210.                                     ->arrayNode('form')
  211.                                     ->addDefaultsIfNotSet()
  212.                                         ->children()
  213.                                         ->scalarNode('type')->defaultValue(ResettingFormType::class)->end()
  214.                                         ->scalarNode('name')->defaultValue('members_user_resetting_form')->end()
  215.                                         ->arrayNode('validation_groups')
  216.                                             ->prototype('scalar')->end()
  217.                                             ->defaultValue(['ResetPassword''Default'])
  218.                                         ->end()
  219.                                     ->end()
  220.                                 ->end()
  221.                             ->end()
  222.                         ->end()
  223.                         ->arrayNode('delete_account')
  224.                             ->addDefaultsIfNotSet()
  225.                             ->canBeUnset()
  226.                                 ->children()
  227.                                     ->arrayNode('form')
  228.                                     ->addDefaultsIfNotSet()
  229.                                     ->children()
  230.                                         ->scalarNode('type')->defaultValue(DeleteAccountFormType::class)->end()
  231.                                         ->scalarNode('name')->defaultValue('members_user_delete_account_form')->end()
  232.                                         ->arrayNode('validation_groups')
  233.                                             ->prototype('scalar')->end()
  234.                                             ->defaultValue(['DeleteAccount''Default'])
  235.                                         ->end()
  236.                                     ->end()
  237.                                 ->end()
  238.                             ->end()
  239.                         ->end()
  240.                         ->arrayNode('sso_identity_complete_profile')
  241.                             ->addDefaultsIfNotSet()
  242.                             ->canBeUnset()
  243.                                 ->children()
  244.                                     ->arrayNode('form')
  245.                                     ->addDefaultsIfNotSet()
  246.                                     ->children()
  247.                                         ->scalarNode('type')->defaultValue(CompleteProfileFormType::class)->end()
  248.                                         ->scalarNode('name')->defaultValue('members_user_sso_identity_complete_profile_form')->end()
  249.                                         ->arrayNode('validation_groups')
  250.                                             ->prototype('scalar')->end()
  251.                                             ->defaultValue(['CompleteProfile''Default'])
  252.                                         ->end()
  253.                                     ->end()
  254.                                 ->end()
  255.                             ->end()
  256.                         ->end()
  257.                     ->end()
  258.                 ->end()
  259.                 ->arrayNode('emails')
  260.                     ->addDefaultsIfNotSet()
  261.                     ->children()
  262.                         ->arrayNode('default')
  263.                             ->addDefaultsIfNotSet()
  264.                             ->children()
  265.                                 ->scalarNode('register_confirm')->isRequired()->defaultValue('/email/register-confirm')->end()
  266.                                 ->scalarNode('register_confirmed')->isRequired()->defaultValue('/email/register-confirmed')->cannotBeEmpty()->end()
  267.                                 ->scalarNode('register_password_resetting')->isRequired()->defaultValue('/email/password-reset')->cannotBeEmpty()->end()
  268.                                 ->scalarNode('admin_register_notification')->isRequired()->defaultValue('/email/admin-register-notification')->cannotBeEmpty()->end()
  269.                             ->end()
  270.                         ->end()
  271.                         ->arrayNode('sites')
  272.                             ->prototype('array')
  273.                             ->children()
  274.                                 ->scalarNode('main_domain')
  275.                                     ->isRequired()
  276.                                     ->cannotBeEmpty()
  277.                                 ->end()
  278.                                 ->arrayNode('emails')
  279.                                     ->children()
  280.                                         ->scalarNode('register_confirm')->isRequired()->cannotBeEmpty()->end()
  281.                                         ->scalarNode('register_confirmed')->isRequired()->cannotBeEmpty()->end()
  282.                                         ->scalarNode('register_password_resetting')->isRequired()->cannotBeEmpty()->end()
  283.                                         ->scalarNode('admin_register_notification')->isRequired()->cannotBeEmpty()->end()
  284.                                     ->end()
  285.                                 ->end()
  286.                             ->end()
  287.                         ->end()
  288.                     ->end()
  289.                 ->end()
  290.             ->end();
  291.         return $treeBuilder;
  292.     }
  293. }