mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	Implemented FOS bundle
This commit is contained in:
		
							
								
								
									
										7
									
								
								application/config/packages/fos_user.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								application/config/packages/fos_user.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
fos_user:
 | 
			
		||||
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
 | 
			
		||||
    firewall_name: main
 | 
			
		||||
    user_class: App\Entity\User
 | 
			
		||||
    from_email:
 | 
			
		||||
        address: "%env(MAILER_SENDER)%"
 | 
			
		||||
        sender_name: "%env(MAILER_USER)%"
 | 
			
		||||
@@ -28,3 +28,5 @@ framework:
 | 
			
		||||
 | 
			
		||||
        # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
 | 
			
		||||
        #app: cache.adapter.apcu
 | 
			
		||||
    templating:
 | 
			
		||||
        engines: ['twig', 'php']
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,13 @@
 | 
			
		||||
security:
 | 
			
		||||
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
 | 
			
		||||
    encoders:
 | 
			
		||||
        App\Entity\User:
 | 
			
		||||
            algorithm: bcrypt
 | 
			
		||||
        FOS\UserBundle\Model\UserInterface: bcrypt
 | 
			
		||||
    providers:
 | 
			
		||||
        our_db_provider:
 | 
			
		||||
            entity:
 | 
			
		||||
                class: App\Entity\User
 | 
			
		||||
                property: username
 | 
			
		||||
        fos_userbundle:
 | 
			
		||||
            id: fos_user.user_provider.username
 | 
			
		||||
    role_hierarchy:
 | 
			
		||||
        ROLE_ADMIN:       ROLE_USER
 | 
			
		||||
        ROLE_SUPER_ADMIN: ROLE_ADMIN
 | 
			
		||||
    hide_user_not_found: false
 | 
			
		||||
    firewalls:
 | 
			
		||||
        dev:
 | 
			
		||||
@@ -16,21 +16,18 @@ security:
 | 
			
		||||
        main:
 | 
			
		||||
            anonymous: true
 | 
			
		||||
            form_login:
 | 
			
		||||
                login_path: login
 | 
			
		||||
                check_path: login
 | 
			
		||||
            logout:
 | 
			
		||||
                path:   /logout
 | 
			
		||||
                target: /
 | 
			
		||||
                provider: fos_userbundle
 | 
			
		||||
                csrf_token_generator: security.csrf.token_manager
 | 
			
		||||
            logout:       true
 | 
			
		||||
 | 
			
		||||
            # activate different ways to authenticate
 | 
			
		||||
 | 
			
		||||
            # http_basic: true
 | 
			
		||||
            # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
 | 
			
		||||
 | 
			
		||||
            # form_login: true
 | 
			
		||||
            # https://symfony.com/doc/current/security/form_login_setup.html
 | 
			
		||||
 | 
			
		||||
    # Easy way to control access for large sections of your site
 | 
			
		||||
    # Note: Only the *first* access control that matches will be used
 | 
			
		||||
    access_control:
 | 
			
		||||
        # - { path: ^/admin, roles: ROLE_ADMIN }
 | 
			
		||||
        # - { path: ^/profile, roles: ROLE_USER }
 | 
			
		||||
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
 | 
			
		||||
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
 | 
			
		||||
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
 | 
			
		||||
        - { path: ^/admin/, role: ROLE_ADMIN }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user