diff --git a/config/packages/nelmio_api_doc.yaml b/config/packages/nelmio_api_doc.yaml index 4e68479..4a2f7c3 100644 --- a/config/packages/nelmio_api_doc.yaml +++ b/config/packages/nelmio_api_doc.yaml @@ -1,9 +1,23 @@ nelmio_api_doc: documentation: + # servers: + # - url: http://api.example.com/unsafe + # description: API over HTTP + # - url: https://api.example.com/secured + # description: API over HTTPS info: - title: My App - description: This is an awesome app! + title: Api puertos Desytel + description: Definiciónd el API de puertos para aplicaciones moviles version: 1.0.0 + components: + securitySchemes: + Bearer: + type: http + scheme: bearer + bearerFormat: JWT + security: + - Bearer: [ ] areas: # to filter documented areas - path_patterns: - - ^/api(?!/doc$) # Accepts routes under /api except /api/doc + default: + path_patterns: + - ^/api(?!/doc$) # Accepts routes under /api except /api/doc diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 030c4de..9ba0297 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -2,15 +2,49 @@ security: # https://symfony.com/doc/current/security/experimental_authenticators.html enable_authenticator_manager: true # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers + password_hashers: + App\Entity\User: + algorithm: argon2i + role_hierarchy: + role_admin: ROLE_USER + role_super_admin: ROLE_SUPER_ADMIN providers: - users_in_memory: { memory: null } + pdadmin_auth: + entity: + class: App\Entity\User + property: email firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false + admin: + pattern: /admin(.*) + provider: pdadmin_auth + lazy: true + user_checker: Pd\UserBundle\Security\UserChecker + switch_user: true + http_basic: ~ + entry_point: form_login + form_login: + use_referer: true + login_path: security_login + check_path: security_login + # provider: fos_userbundle + # login_path: /admin/login + use_forward: false + # check_path: /admin/login_check + failure_path: null + # csrf_token_generator: security.csrf.token_manager + logout: + path: security_logout + #path: /admin/logout + remember_me: + secret: '%env(APP_SECRET)%' + #lifetime: 604800 + path: / main: lazy: true - provider: users_in_memory + #provider: users_in_memory # activate different ways to authenticate # https://symfony.com/doc/current/security.html#firewalls-authentication @@ -21,5 +55,8 @@ security: # 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: ^/admin/login$, role: PUBLIC_ACCESS } + - { path: ^/admin/register, role: PUBLIC_ACCESS } + - { path: ^/admin/resetting, role: PUBLIC_ACCESS } + - { path: ^/admin, roles: ROLE_ADMIN } + - { path: ^/profile, roles: ROLE_USER } diff --git a/config/packages/sonata_admin.yaml b/config/packages/sonata_admin.yaml index 28f4f34..ba7d31b 100644 --- a/config/packages/sonata_admin.yaml +++ b/config/packages/sonata_admin.yaml @@ -1,6 +1,47 @@ sonata_admin: - title: 'Sonata Admin' + title: 'Redytel Puertos' dashboard: + groups: + cms: + label: CMS + label_catalogue: ~ + items: + - admin.pagina + - admin.formularios + - admin.menu + roles: ['ROLE_ADMIN', 'ROLE_SONATA_ADMIN'] + prductos: + label: Productos + label_catalogue: ~ + items: + - admin.categorias + - admin.productos + - admin.comentarios + roles: ['ROLE_ADMIN', 'ROLE_SONATA_ADMIN'] + ventas: + label: Ventas + label_catalogue: ~ + items: + - admin.clientes + - admin.facturas + +# roles: ['ROLE_ADMIN', 'ROLE_SONATA_ADMIN'] + usuarios: + label: Usuarios + label_catalogue: ~ + items: + - admin.user + #- admin.invitacion + roles: ['ROLE_ADMIN', 'ROLE_SONATA_ADMIN'] + configureacion: + label: Configuracion + label_catalogue: ~ + items: + - admin.idioma + - admin.modulos + - admin.plantillas + #- admin.invitacion + roles: ['ROLE_ADMIN', 'ROLE_SONATA_ADMIN'] blocks: - { type: sonata.admin.block.admin_list, position: left } diff --git a/config/packages/user.yaml b/config/packages/user.yaml new file mode 100644 index 0000000..7f18f4f --- /dev/null +++ b/config/packages/user.yaml @@ -0,0 +1,16 @@ +pd_user: + user_class: App\Entity\User + #profile_class: App\Entity\Profile + group_class: App\Entity\Group + default_group: '' + login_redirect: 'home' + email_confirmation: true + welcome_email: true + user_registration: true + #template_path: '@Admin/Auth' + resetting_request_time: 7200 + mail_sender_address: 'example@example.com' + mail_sender_name: 'pdUser' + active_language: ['es', 'en'] + register_type: '' + resetting_type: '' diff --git a/config/routes.yaml b/config/routes.yaml index c3283aa..986d4bc 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,10 @@ #index: # path: / # controller: App\Controller\DefaultController::index +authorization: + resource: "@PdUserBundle/Resources/config/routing.yaml" + prefix: 'admin' + +#_welcome: +# path: / +# controller: App\Controller\HomePageController::homepage diff --git a/config/routes/nelmio_api_doc.yaml b/config/routes/nelmio_api_doc.yaml index 364b4af..f350dd6 100644 --- a/config/routes/nelmio_api_doc.yaml +++ b/config/routes/nelmio_api_doc.yaml @@ -6,7 +6,7 @@ app.swagger: ## Requires the Asset component and the Twig bundle ## $ composer require twig asset -#app.swagger_ui: -# path: /api/doc -# methods: GET -# defaults: { _controller: nelmio_api_doc.controller.swagger_ui } +app.swagger_ui: + path: /api/doc + methods: GET + defaults: { _controller: nelmio_api_doc.controller.swagger_ui } diff --git a/config/services.yaml b/config/services.yaml index aa092ce..36740a3 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -4,7 +4,7 @@ # Put parameters here that don't need to change on each machine where the app is deployed # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: - + locale: es services: # default configuration for services in *this* file _defaults: diff --git a/src/Controller/HomePageController.php b/src/Controller/HomePageController.php new file mode 100644 index 0000000..09833ef --- /dev/null +++ b/src/Controller/HomePageController.php @@ -0,0 +1,18 @@ +render('base.html.twig'); + } + + +} \ No newline at end of file