Selaa lähdekoodia

Se agregó la config, routing y security. Update vendors

Guillermo Espinoza 7 vuotta sitten
vanhempi
commit
1a276d6813

+ 1 - 0
.gitignore

@@ -15,6 +15,7 @@
 !var/SymfonyRequirements.php
 /vendor/
 /web/bundles/
+/app/Resources/workflows/workflow_list.yml
 /app/config/bundles/hwi/oauth-bundle/parameters.yml
 /app/config/bundles/ik/audit-bundle/parameters.yml
 /app/config/bundles/ik/base-admin-bundle/parameters.yml

+ 27 - 1
app/AppKernel.php

@@ -15,7 +15,33 @@ class AppKernel extends Kernel
             new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
             new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
             new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
-            new AppBundle\AppBundle(),
+            new Sonata\CoreBundle\SonataCoreBundle(),
+            new Sonata\BlockBundle\SonataBlockBundle(),
+            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
+            new Sonata\AdminBundle\SonataAdminBundle(),
+            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
+            new FOS\RestBundle\FOSRestBundle(),
+            new Voryx\RESTGeneratorBundle\VoryxRESTGeneratorBundle(),
+            new JMS\SerializerBundle\JMSSerializerBundle($this),
+            new Nelmio\CorsBundle\NelmioCorsBundle(),
+            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
+            new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
+            new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
+            new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
+            new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
+            new Base\AdminBundle\BaseAdminBundle(),
+            new Base\OAuthClientBundle\BaseOAuthClientBundle(),
+            new WebserviceBundle\WebserviceBundle(),
+            new WorkflowBundle\WorkflowBundle(),
+            new TemplateBundle\TemplateBundle(),
+            new ExtraDataBundle\ExtraDataBundle(),
+            new DeviceBundle\DeviceBundle(),
+            new OwnerVoterBundle\OwnerVoterBundle(),
+            new MigrationsBundle\MigrationsBundle(),
+            new MapBundle\MapBundle(),
+            new LeafletBundle\LeafletBundle(),
+            new AuthBundle\AuthBundle(),
+            new AuditBundle\AuditBundle(),
         ];
 
         if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

+ 17 - 0
app/Resources/SonataAdminBundle/views/CRUD/list__action_delete.html.twig

@@ -0,0 +1,17 @@
+{#
+
+This file is part of the Sonata package.
+
+(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
+
+For the full copyright and license information, please view the LICENSE
+file that was distributed with this source code.
+
+#}
+
+{% if admin.hasAccess('delete', object) and owner_voter.vote(token_security.token, object, ['delete']) >= 0 and admin.hasRoute('delete') %}
+    <a href="{{ admin.generateObjectUrl('delete', object) }}" class="btn btn-sm btn-default delete_link" title="{{ 'action_delete'|trans({}, 'SonataAdminBundle') }}">
+        <i class="fa fa-times" aria-hidden="true"></i>
+        {{ 'action_delete'|trans({}, 'SonataAdminBundle') }}
+    </a>
+{% endif %}

+ 18 - 0
app/Resources/SonataAdminBundle/views/CRUD/list__action_edit.html.twig

@@ -0,0 +1,18 @@
+{#
+
+This file is part of the Sonata package.
+
+(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
+
+For the full copyright and license information, please view the LICENSE
+file that was distributed with this source code.
+
+#}
+
+{% if admin.hasAccess('edit', object) and owner_voter.vote(token_security.token, object, ['edit']) >= 0 and admin.hasRoute('edit') %}
+    <a href="{{ admin.generateObjectUrl('edit', object) }}" class="btn btn-sm btn-default edit_link"
+       title="{{ 'action_edit'|trans({}, 'SonataAdminBundle') }}">
+        <i class="fa fa-pencil" aria-hidden="true"></i>
+        {{ 'action_edit'|trans({}, 'SonataAdminBundle') }}
+    </a>
+{% endif %}

+ 43 - 0
app/Resources/workflows/workflow_list.yml.dist

@@ -0,0 +1,43 @@
+#framework:
+#  workflows:
+#    olt_workflow:
+#      type: state_machine
+#      marking_store:
+#        type: single_state
+#        arguments:
+#          - currentState
+#      supports:
+#        - RadiusBundle\Entity\OLT
+#      initial_place: disabled
+#      places:
+#        - enabled
+#        - disabled
+#      transitions:
+#        disable:
+#          from: enabled
+#          to: disabled
+#        enable:
+#          from: disabled
+#          to: enabled
+#    onu_workflow:
+#      type: state_machine
+#      marking_store:
+#        type: single_state
+#        arguments:
+#          - currentState
+#      supports:
+#        - RadiusBundle\Entity\ONU
+#      initial_place: active
+#      places:
+#        - active
+#        - disable
+#      transitions:
+#        add_config:
+#          from: active
+#          to: active
+#        disable:
+#          from: active
+#          to: disable
+#        active:
+#          from: disable
+#          to: active

+ 15 - 4
app/config/bundles/ik/webservice-bundle/parameters.yml.dist

@@ -1,10 +1,21 @@
 parameters:
     url_base: 'http://127.0.0.1/base/app_dev.php' # url app Base
+    url_mapas: 'http://127.0.0.1/mapas/app_dev.php' # url app Mapas
+    url_stats: 'http://127.0.0.1/stats/app_dev.php' # url app Stats
+    url_ftth: 'http://127.0.0.1/ftth/app_dev.php' # url app FTTH
+    url_radius: 'http://127.0.0.1/radius/app_dev.php' # url app Radius
 
     client: '%url_base%/api/clients.json'
 
-    sidebar_menu: # urls para el sidebar menu 
+    sidebar_menu: # urls para el sidebar menu
         Base: '%url_base%'
-
-    # Url base create client
-    remote_client_create_url: '%url_base%/admin/client/client/create'
+        Mapas: '%url_mapas%'
+        Stats: '%url_stats%'
+        FTTH: '%url_ftth%'
+        Radius: '%url_radius%'
+    
+    remote_client_create_url: '%url_base%/admin/client/client/create' # Url base create client
+    remote_device_url: '%url_base%/api/devices.json'
+    remote_device_log_url: '%url_base%/api/devicelogs.json'
+    remote_get_map_url: '%url_mapas%/api/maps.json'
+    remote_get_object_type_url: '%url_mapas%/api/objecttypes.json'

+ 15 - 4
app/config/bundles/ik/webservice-bundle/parameters.yml.docker

@@ -1,10 +1,21 @@
 parameters:
     url_base: 'http://%env(HOST_BASE)%' # url app Base
+    url_mapas: 'http://%env(HOST_MAPAS)%' # url app Mapas
+    url_stats: 'http://%env(HOST_STATS)%' # url app Stats
+    url_ftth: 'http://%env(HOST_FTTH)%' # url app FTTH
+    url_radius: 'http://%env(HOST_RADIUS)%' # url app Radius
 
     client: '%url_base%/api/clients.json'
 
-    sidebar_menu: # urls para el sidebar menu 
+    sidebar_menu: # urls para el sidebar menu
         Base: '%url_base%'
-
-    # Url base create client
-    remote_client_create_url: '%url_base%/admin/client/client/create'
+        Mapas: '%url_mapas%'
+        Stats: '%url_stats%'
+        FTTH: '%url_ftth%'
+        Radius: '%url_radius%'
+    
+    remote_client_create_url: '%url_base%/admin/client/client/create' # Url base create client
+    remote_device_url: '%url_base%/api/devices.json'
+    remote_device_log_url: '%url_base%/api/devicelogs.json'
+    remote_get_map_url: '%url_mapas%/api/maps.json'
+    remote_get_object_type_url: '%url_mapas%/api/objecttypes.json'

+ 58 - 5
app/config/config.yml

@@ -1,12 +1,32 @@
 imports:
     - { resource: parameters.yml }
-    - { resource: security.yml }
     - { resource: services.yml }
+    - { resource: "@AuditBundle/Resources/config/services.yml" }
+    - { resource: "@AuthBundle/Resources/config/services.yml" }
+    - { resource: '@BaseAdminBundle/Resources/config/services.yml' }
+    - { resource: '@BaseAdminBundle/Resources/config/sonata-config.yml' }
+    - { resource: "@BaseOAuthClientBundle/Resources/config/services.yml" }
+    - { resource: "@BaseOAuthClientBundle/Resources/config/hwioauthbundle/services.yml" }
+    - { resource: "@BaseOAuthClientBundle/Resources/config/hwioauthbundle/config.yml" }
+    - { resource: "@DeviceBundle/Resources/config/services.yml" }
+    - { resource: "@ExtraDataBundle/Resources/config/services.yml" }
+    - { resource: "@MapBundle/Resources/config/services.yml" }
+    - { resource: "@OwnerVoterBundle/Resources/config/services.yml" }
+    - { resource: "@TemplateBundle/Resources/config/services.yml" }
+    - { resource: "@WebserviceBundle/Resources/config/services.yml" }
+    - { resource: "@WorkflowBundle/Resources/config/services.yml" }
+    - { resource: "../Resources/workflows/workflow_list.yml", ignore_errors: true  }
+    - { resource: "bundles/friendsofsymfony/rest-bundle/config.yml" }
+    - { resource: "bundles/hwi/oauth-bundle/parameters.yml" }
+    - { resource: "bundles/ik/audit-bundle/parameters.yml" }
+    - { resource: "bundles/ik/base-admin-bundle/parameters.yml" }
+    - { resource: "bundles/ik/device-bundle/parameters.yml" }
+    - { resource: "bundles/ik/webservice-bundle/parameters.yml" }
 
 # Put parameters here that don't need to change on each machine where the app is deployed
 # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
 parameters:
-    locale: en
+    locale: es
 
 framework:
     #esi: ~
@@ -24,8 +44,9 @@ framework:
     default_locale: '%locale%'
     trusted_hosts: ~
     session:
-        # https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
-        handler_id: session.handler.native_file
+        name: flowdat_cablemodem_session
+        # http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
+        handler_id: session.handler.pdo
         save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
     fragments: ~
     http_method_override: true
@@ -37,6 +58,18 @@ framework:
 twig:
     debug: '%kernel.debug%'
     strict_variables: '%kernel.debug%'
+    form_themes:
+        - 'WebserviceBundle:Type:remote_client_widget.html.twig'
+        - 'LeafletBundle:Form/Type:leaflet_map_widget.html.twig'
+    globals:
+        owner_voter: '@owner_voter.voter'
+        token_security: '@security.token_storage'
+        script_google_maps: 'https://maps.googleapis.com/maps/api/js?v=3&key=%googlemaps_api_key%'
+        token_security: '@security.token_storage'
+        owner_voter: '@owner_voter.voter'
+        fd_alerts: '@base_admin.alert_service'
+        tenancy_service: '@base_tenancy.tenancy_service'
+        checked_is_user_logged_in: '%app.checked_is_user_logged_in%'    
 
 # Doctrine Configuration
 doctrine:
@@ -59,6 +92,8 @@ doctrine:
         auto_generate_proxy_classes: '%kernel.debug%'
         naming_strategy: doctrine.orm.naming_strategy.underscore
         auto_mapping: true
+        filters:
+            tenancy_filter: Base\AdminBundle\Filter\TenancyFilter
 
 # Swiftmailer Configuration
 swiftmailer:
@@ -66,4 +101,22 @@ swiftmailer:
     host: '%mailer_host%'
     username: '%mailer_user%'
     password: '%mailer_password%'
-    spool: { type: memory }
+    spool: { type: memory }   
+
+sonata_block:
+    default_contexts: [sonata_page_bundle]
+    blocks:
+        sonata.admin.block.admin_list:
+            contexts:   [admin]
+
+sonata_admin:
+    templates:
+        layout: BaseAdminBundle::standard_layout.html.twig
+        user_block: BaseOAuthClientBundle:Core:oauth_user_block.html.twig    
+
+doctrine_migrations:
+    dir_name: "%kernel.root_dir%/DoctrineMigrations"
+    namespace: Application\Migrations
+    table_name: migration_versions
+    name: Application Migrations
+    organize_migrations: false # Version >=1.2 Possible values are: "BY_YEAR", "BY_YEAR_AND_MONTH", false

+ 1 - 0
app/config/config_dev.yml

@@ -1,5 +1,6 @@
 imports:
     - { resource: config.yml }
+    - { resource: security.yml }
 
 framework:
     router:

+ 1 - 0
app/config/config_prod.yml

@@ -1,5 +1,6 @@
 imports:
     - { resource: config.yml }
+    - { resource: security.yml }
 
 #doctrine:
 #    orm:

+ 1 - 0
app/config/config_test.yml

@@ -1,5 +1,6 @@
 imports:
     - { resource: config_dev.yml }
+    - { resource: security_test.yml }
 
 framework:
     test: ~

+ 1 - 1
app/config/parameters.yml.dist

@@ -4,7 +4,7 @@
 parameters:
     database_host: 127.0.0.1
     database_port: ~
-    database_name: symfony
+    database_name: fd3_cablemodem
     database_user: root
     database_password: ~
     # You should uncomment this if you want to use pdo_sqlite

+ 57 - 3
app/config/routing.yml

@@ -1,3 +1,57 @@
-app:
-    resource: '@AppBundle/Controller/'
-    type: annotation
+login:
+    path: /admin/login
+    defaults:
+        _controller: FrameworkBundle:Redirect:urlRedirect
+        path: /connect/login
+        permanent: true
+
+connect-login:
+    path: /login/
+    defaults:
+        _controller: FrameworkBundle:Redirect:redirect
+        route: hwi_oauth_service_redirect
+        service: login
+        permanent: true
+
+logout:
+    path: /logout
+
+homepage:
+    path: /
+    defaults:
+        _controller: FrameworkBundle:Redirect:urlRedirect
+        path: /admin/dashboard
+        permanent: true
+
+webservice:
+    resource: "@WebserviceBundle/Resources/config/routing.yml"
+    prefix:   /
+
+base_oauth_client:
+    resource: "@BaseOAuthClientBundle/Resources/config/routing.yml"
+
+base_hwioauthbundle_oauth_client:
+    resource: "@BaseOAuthClientBundle/Resources/config/hwioauthbundle/routing.yml"
+
+workflow:
+    resource: "@WorkflowBundle/Resources/config/routing/admin.xml"
+    prefix:   /
+
+base_admin_alert:
+    resource: "@BaseAdminBundle/Controller/"
+    type:     annotation
+    prefix:   /
+
+map:
+    resource: "@MapBundle/Resources/config/routing.yml"
+
+audit:
+    resource: "@AuditBundle/Controller/"
+    type:     annotation
+    prefix:   /
+
+base_admin:
+    resource: "@BaseAdminBundle/Resources/config/routing.yml"
+    
+_sonata:
+    resource: "bundles/sonata-project/admin-bundle/routing.yml"    

+ 37 - 0
app/config/security.drone.yml

@@ -0,0 +1,37 @@
+security:
+
+    providers:
+        oauth:
+            id: base_oauth_bundle.oauth_user_provider
+
+    role_hierarchy:
+        ROLE_ADMIN: [ROLE_USER, ROLE_ALLOWED_TO_SWITCH]
+        ROLE_SUPER_ADMIN: ROLE_ADMIN
+
+    firewalls:
+        dev:
+            pattern: ^/(_(profiler|wdt)|css|images|js)/
+            security: false
+        secured_area:
+            pattern: ^/
+            logout:
+                path:   /logout
+                target: /
+                success_handler: base_admin.security.logout.handler
+            anonymous: true
+
+            # HWIOAuthBundle + BaseOAuthBundle Configuration
+            oauth:
+                login_path: /login
+                failure_path: /login
+                check_path: /login
+                resource_owners:
+                    login: /login_check
+                oauth_user_provider:
+                    service: base_oauth_bundle.oauth_user_provider
+
+    access_control:
+        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+        - { path: ^/admin/, role: ROLE_ADMIN }
+        - { path: ^/efconnect, role: ROLE_USER }
+        - { path: ^/elfinder, role: ROLE_USER }

+ 35 - 18
app/config/security.yml

@@ -1,24 +1,41 @@
-# To get started with security, check out the documentation:
-# https://symfony.com/doc/current/security.html
 security:
-
-    # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
     providers:
-        in_memory:
-            memory: ~
-
-    firewalls:
-        # disables authentication for assets and the profiler, adapt it according to your needs
+        oauth:
+            id: base_oauth_bundle.oauth_user_provider
+    
+    role_hierarchy:
+        ROLE_ADMIN: [ROLE_USER, ROLE_ALLOWED_TO_SWITCH]
+        ROLE_SUPER_ADMIN: ROLE_ADMIN
+            
+    firewalls:       
+                                
         dev:
             pattern: ^/(_(profiler|wdt)|css|images|js)/
             security: false
+            
+        api:
+          pattern: ^/api
+          stateless: true
+          oauth_proxy: true
 
-        main:
-            anonymous: ~
-            # activate different ways to authenticate
-
-            # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
-            #http_basic: ~
-
-            # https://symfony.com/doc/current/security/form_login_setup.html
-            #form_login: ~
+        secured_area:
+            pattern: ^/
+            logout:
+                path:   /logout
+                target: /
+                success_handler: base_admin.security.logout.handler
+            anonymous: true
+            # HWIOAuthBundle + BaseOAuthBundle Configuration
+            oauth:
+                login_path: /login
+                failure_path: /login
+                check_path: /login
+                resource_owners:
+                    login: /login_check
+                oauth_user_provider:
+                    service: base_oauth_bundle.oauth_user_provider
+          
+    access_control:
+        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+        - { path: ^/admin/, role: ROLE_ADMIN }
+        - { path: ^/api, role: ROLE_USER }

+ 42 - 0
app/config/security_test.yml

@@ -0,0 +1,42 @@
+security:
+
+    providers:
+        oauth:
+            id: base_oauth_bundle.oauth_user_provider
+
+    role_hierarchy:
+        ROLE_ADMIN: [ROLE_USER, ROLE_ALLOWED_TO_SWITCH]
+        ROLE_SUPER_ADMIN: ROLE_ADMIN
+
+    firewalls:
+        dev:
+            pattern: ^/(_(profiler|wdt)|css|images|js)/
+            security: false
+        
+        api:
+          pattern: ^/api
+          stateless: true
+          anonymous: true
+          http_basic: ~   
+            
+        secured_area:
+            pattern: ^/
+            logout:
+                path:   /logout
+                target: /
+                success_handler: base_admin.security.logout.handler
+            anonymous: true
+
+            # HWIOAuthBundle + BaseOAuthBundle Configuration
+            oauth:
+                login_path: /login
+                failure_path: /login
+                check_path: /login
+                resource_owners:
+                    login: /login_check
+                oauth_user_provider:
+                    service: base_oauth_bundle.oauth_user_provider
+
+    access_control:
+        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+        - { path: ^/admin/, role: ROLE_ADMIN }

+ 9 - 9
app/config/services.yml

@@ -16,18 +16,18 @@ services:
 
     # makes classes in src/AppBundle available to be used as services
     # this creates a service per class whose id is the fully-qualified class name
-    AppBundle\:
-        resource: '../../src/AppBundle/*'
-        # you can exclude directories or files
-        # but if a service is unused, it's removed anyway
-        exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
+#    AppBundle\:
+#        resource: '../../src/AppBundle/*'
+#        # you can exclude directories or files
+#        # but if a service is unused, it's removed anyway
+#        exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
 
     # controllers are imported separately to make sure they're public
     # and have a tag that allows actions to type-hint services
-    AppBundle\Controller\:
-        resource: '../../src/AppBundle/Controller'
-        public: true
-        tags: ['controller.service_arguments']
+#    AppBundle\Controller\:
+#        resource: '../../src/AppBundle/Controller'
+#        public: true
+#        tags: ['controller.service_arguments']
 
     # add more services, or override services that need manual wiring
     # AppBundle\Service\ExampleService:

+ 0 - 3
composer.json

@@ -212,9 +212,6 @@
             "@auto-increment"
         ]
     },
-    "config": {
-        "sort-packages": true
-    },
     "extra": {
         "symfony-app-dir": "app",
         "symfony-bin-dir": "bin",

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 5084 - 830
composer.lock


+ 0 - 9
src/AppBundle/AppBundle.php

@@ -1,9 +0,0 @@
-<?php
-
-namespace AppBundle;
-
-use Symfony\Component\HttpKernel\Bundle\Bundle;
-
-class AppBundle extends Bundle
-{
-}

+ 0 - 21
src/AppBundle/Controller/DefaultController.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace AppBundle\Controller;
-
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Symfony\Component\HttpFoundation\Request;
-
-class DefaultController extends Controller
-{
-    /**
-     * @Route("/", name="homepage")
-     */
-    public function indexAction(Request $request)
-    {
-        // replace this example code with whatever you need
-        return $this->render('default/index.html.twig', [
-            'base_dir' => realpath($this->getParameter('kernel.project_dir')).DIRECTORY_SEPARATOR,
-        ]);
-    }
-}

+ 0 - 0
var/cache/.gitkeep


+ 0 - 0
var/logs/.gitkeep


+ 0 - 0
var/sessions/.gitkeep


+ 0 - 0
web/workflows_png/.gitkeep