Ver código fonte

updated docs + removed unnecessary

Roel Sint 13 anos atrás
pai
commit
33683874f6

+ 1 - 1
Admin/Entity/UserAdmin.php

@@ -29,7 +29,7 @@ class UserAdmin extends Admin
     protected function configureListFields(ListMapper $listMapper)
     protected function configureListFields(ListMapper $listMapper)
     {
     {
         $listMapper
         $listMapper
-            ->addIdentifier('username', null, array('template' => 'SonataUserBundle:UserAdmin:list_field_username.html.twig'))
+            ->addIdentifier('username')
             ->add('email')
             ->add('email')
             ->add('enabled')
             ->add('enabled')
             ->add('locked')
             ->add('locked')

+ 16 - 4
Resources/doc/reference/installation.rst

@@ -101,6 +101,18 @@ Now, add the new `Application` Bundle into the kernel
   }
   }
 
 
 
 
+Acl Configuration
+-----------------
+
+When using ACL, the UserBundle can prevent ``normal`` user to change settings of ``super-admin`` users, to enable this
+add to the configuration:
+
+.. code-block:: yaml
+
+    # app/config/config.yml
+    sonata_user:
+        security_acl: true
+
 Doctrine Configuration
 Doctrine Configuration
 ----------------------
 ----------------------
 
 
@@ -145,10 +157,10 @@ Then add a new custom firewall handlers for the admin
 
 
     security:
     security:
         role_hierarchy:
         role_hierarchy:
-            ROLE_ADMIN:       ROLE_USER
-            ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
+            ROLE_ADMIN:       [ROLE_USER, ROLE_SONATA_ADMIN]
+            ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]        
             SONATA:
             SONATA:
-                - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT  # if you are not using acl then this line must be uncommented
+                - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT  # if you are using acl then this line must be commented
 
 
         providers:
         providers:
             fos_userbundle:
             fos_userbundle:
@@ -212,7 +224,7 @@ The last part is to define 3 new access control rules :
 
 
 
 
 Using the roles
 Using the roles
----------------------------------------------------
+---------------
 
 
 Each admin has its own roles, use the user form to assign them to other users. The available roles to assign to others
 Each admin has its own roles, use the user form to assign them to other users. The available roles to assign to others
 are limited to the roles available to the user editing the form.
 are limited to the roles available to the user editing the form.

+ 9 - 2
Resources/doc/reference/introduction.rst

@@ -3,5 +3,12 @@ Introduction
 
 
 Integrate the FOS/UserBundle in the Sonata Admin Project
 Integrate the FOS/UserBundle in the Sonata Admin Project
 
 
-    - AdminBundle: add user and group management
-    - EasyExtends: allows to generate Application level model
+ - AdminBundle: add user and group management
+ - EasyExtends: allows to generate Application level model
+    
+The roles to be assigned to users is split in 2 parts:
+
+ - editable: the roles the current user is allowed to assign to other users (permission or role ``MASTER``)
+ - readonly: the roles assigned to the current user, however the current user is only allowed to see them
+
+ When using ACL, the UserBundle prevents ``normal`` user to change settings of ``super-admin`` users.

+ 0 - 27
Resources/views/UserAdmin/list_field_username.html.twig

@@ -1,27 +0,0 @@
-{#
-
-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.
-
-#}
-
-<td class="sonata-ba-list-field sonata-ba-list-field-{{ field_description.type }}" objectId="{{ admin.id(object) }}">
-    {% if field_description.options.identifier is defined and admin.isGranted('VIEW', object) %}
-
-        {% if admin.hasroute('edit') and admin.isGranted('EDIT', object) %}
-            <a href="{{ admin.generateObjectUrl('edit', object) }}">
-        {% elseif admin.hasroute('show') and admin.show|length > 0 %}
-            <a href="{{ admin.generateObjectUrl('show', object) }}">
-        {% endif %}
-
-            {% block field %}{{ value }}{% endblock %}
-        </a>
-
-    {% else %}
-        {{ block('field') }}
-    {% endif %}
-</td>