Browse Source

Implementacion de OwnerVoterBundle en TemplateBundle

gabriel 8 years ago
parent
commit
ca853b1d82

+ 1 - 0
app/AppKernel.php

@@ -35,6 +35,7 @@ class AppKernel extends Kernel
             new TemplateBundle\TemplateBundle(),
             new ExtraDataBundle\ExtraDataBundle(),
             new DeviceBundle\DeviceBundle(),
+            new OwnerVoterBundle\OwnerVoterBundle()
         ];
 
         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 %}

+ 3 - 0
app/config/config.yml

@@ -18,6 +18,7 @@ imports:
     - { resource: "@ExtraDataBundle/Resources/config/services.yml" }
     - { resource: "bundles/ik/device-bundle/parameters.yml" }
     - { resource: "@DeviceBundle/Resources/config/services.yml" }
+    - { resource: "@OwnerVoterBundle/Resources/config/services.yml" }
 
 parameters:
     app_name: ftth
@@ -58,6 +59,8 @@ twig:
     globals:
         base_url: %url_base%
         fd_alerts: '@base_admin.alert_service'
+        token_security: '@security.token_storage'
+        owner_voter: '@owner_voter.voter'
 
 # Doctrine Configuration
 doctrine:

+ 9 - 1
composer.json

@@ -59,6 +59,13 @@
             "options": {
                     "local_pk": "./keys/bitbucket.id_rsa"
             }
+        },
+        {
+            "type": "vcs",
+            "url":  "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/OwnerVoter.git",
+            "options": {
+                    "local_pk": "./keys/bitbucket.id_rsa"
+            }
         }
     ],
     "config":{
@@ -90,7 +97,8 @@
         "php-amqplib/rabbitmq-bundle": "^1.12",
         "ik/template-bundle": "dev-master",
         "ik/extra-data-bundle": "dev-master",
-        "ik/device-bundle": "dev-master"
+        "ik/device-bundle": "dev-master",
+        "ik/owner-voter-bundle": "dev-master"
     },
     "require-dev": {
         "sensio/generator-bundle": "^3.0",