Skip to content

Commit fcc2fe2

Browse files
DOC-1919: Review and update dev documentation (part 9) m (#34009)
* DOC-1919: Search documentation for mistakes, typos and potential improvements (Part 9) -acls -attachments -attributes -create entities -crud -custom-field-validation -customize-crud -dictionaries -doctrine-field-types - entities - backend/datasource - backend/extensions - backend/data-grids Co-authored-by: Daria Hanzenko <[email protected]>
1 parent 3200799 commit fcc2fe2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+740
-1144
lines changed

backend/dashboards/index.rst

+7-23
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,20 @@ Dashboards
1111
Create a Dashboard Widget
1212
-------------------------
1313

14-
To display a list of tasks on the dashboard with most recent tasks first you basically have to
15-
perform three steps:
14+
To display a list of tasks on the dashboard with the most recent tasks:
1615

17-
#. :ref:`Create a data grid <cookbook-entities-dashboard-grid>` that collects and displays the data
18-
of the tasks while making sure that most recent tasks are displayed on top.
16+
#. :ref:`Create a data grid <cookbook-entities-dashboard-grid>` that collects and displays the tasks' data while ensuring that the most recent tasks are displayed on top.
1917

2018
#. :ref:`Create a Twig template <cookbook-entities-dashboard-template>` that renders the grid.
2119

22-
#. Finally, to write everything together, :ref:`configure <cookbook-entities-dashboard-config>` the
23-
dashboard widget by telling it which template to render.
20+
#. :ref:`Сonfigure <cookbook-entities-dashboard-config>` the dashboard widget by telling it which template to render.
2421

2522
.. _cookbook-entities-dashboard-grid:
2623

2724
Configuring the Grid
2825
~~~~~~~~~~~~~~~~~~~~
2926

30-
The data grid that will be displayed on the dashboard can be based upon the already existing
31-
``app-tasks-grid`` that you used to show a grid of all the tasks being present. You just need to
32-
sort the result (the id can be used as a sorting criteria as more recent tasks will have higher
33-
ids):
27+
The data grid that will be displayed on the dashboard can be based on the already existing ``app-tasks-grid`` that you used to show a grid of all the tasks being present. Sort the result (the id can be used as a sorting criterion as more recent tasks will have higher ids):
3428

3529
.. code-block:: yaml
3630
:caption: src/Acme/Bundle/DemoBundle/Resources/config/oro/datagrids.yml
@@ -48,11 +42,7 @@ ids):
4842
Widget Template
4943
~~~~~~~~~~~~~~~
5044

51-
To actually render the data grid on the dashboard you need to create a Twig template that is based
52-
on the ``@OroDashboard/Dashboard/widget.html.twig`` template. To do so create a template named
53-
``recent_tasks_widget.html.twig`` located in the ``Resources/views/Dashboard`` directory of your
54-
bundle (see :ref:`cookbook-entities-dashboard-config` for an explanation of the schema you should
55-
follow for the template name and location) with the following content:
45+
To render the data grid on the dashboard, create a Twig template based on the ``@OroDashboard/Dashboard/widget.html.twig`` template. You will need to create a template called ``recent_tasks_widget.html.twig`` located in the ``Resources/views/Dashboard`` directory of you bundle (see :ref:`cookbook-entities-dashboard-config` for an explanation of the schema to follow for the template name and location) with the following content:
5646

5747
.. code-block:: html+jinja
5848
:caption: src/Acme/Bundle/DemoBundle/Resources/views/Dashboard/recent_tasks_widget.html.twig
@@ -92,14 +82,8 @@ Adding Widget Configuration
9282
name: recent_tasks_widget
9383
description: This widget displays the most recent tasks
9484
95-
The configured ``oro_dashboard_widget`` route refers to a controller action that comes as part of
96-
the ``Oro\Bundle\DashboardBundle\Controller\DashboardController`` and simply renders a
97-
template whose name is inferred from route parameters (the name of the template that the controller
98-
is looking for follows the ``{{bundle}}:Dashboard:{{name}}`` pattern where ``{{bundle}}`` and
99-
``{{name}}`` refer to the route parameters of the dashboard config).
85+
The configured ``oro_dashboard_widget`` route refers to a controller action that comes as part of the ``Oro\Bundle\DashboardBundle\Controller\DashboardController`` and renders a template whose name is inferred from route parameters (the name of the template that the controller is looking for follows the ``{{bundle}}:Dashboard:{{name}}`` pattern where ``{{bundle}}`` and ``{{name}}`` refer to the route parameters of the dashboard config).
10086

10187
.. tip::
10288

103-
If your widget contains some more logic (e.g. calling some service and doing something with its
104-
result, you can create your own controller, configure a route for it, and then refer to this
105-
route with the ``route`` key in your widget configuration.
89+
If your widget contains some more logic (e.g., calling some service and doing something with its result), you can create your own controller, configure a route for it, and then refer to this route with the ``route`` key in your widget configuration.

backend/emails/index.rst

+57-113
Large diffs are not rendered by default.

backend/entities/acls.rst

+29-58
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ Using ACLs you can granularly grant access to your entities. Doing so requires t
77

88
#. :ref:`Create access control lists for all available actions <coobook-entities-acl-create>`.
99

10-
#. :ref:`Add access checks<coobook-entities-acl-check>` to where your entities are displayed or
11-
manipulated.
10+
#. :ref:`Add access checks<coobook-entities-acl-check>` to where your entities are displayed or manipulated.
1211

1312
.. _coobook-entities-acl-enable:
1413

1514
Activating ACL Checks on your Entities
1615
--------------------------------------
1716

18-
In order to have your entity available in the admin UI to be able to assign permissions to your
19-
users you have to enable ACLs for these entities using the ``@Config`` annotation:
17+
To have your entity available in the admin UI to be able to assign permissions to your users, you have to enable ACLs for these entities using the ``@Config`` annotation:
2018

2119
.. code-block:: php
2220
:caption: src/Acme/Bundle/DemoBundle/Entity/Task.php
@@ -41,13 +39,11 @@ users you have to enable ACLs for these entities using the ``@Config`` annotatio
4139
{
4240
}
4341
44-
After you have done this and have cleared the cache you can toggle all kinds of permission checks
45-
(``CREATE``, ``EDIT``, ``DELETE``, ``VIEW``, and ``ASSIGN``) in the user role management interface.
42+
After you have done this and have cleared the cache, you can toggle all kinds of permission checks (``CREATE``, ``EDIT``, ``DELETE``, ``VIEW``, and ``ASSIGN``) in the user role management interface.
4643

4744
.. tip::
4845

49-
You can use the optional ``group_name`` attribute to group entities by application. The value
50-
of this attribute is used to split the configured access control list into application scopes.
46+
You can use the optional ``group_name`` attribute to group entities by application. The value of this attribute is used to split the configured access control list into application scopes.
5147

5248
.. _coobook-entities-acl-create:
5349

@@ -112,14 +108,9 @@ You have two options to define your custom access control lists:
112108
}
113109
}
114110
115-
Using the ``@Acl`` annotation does not only create new access control lists to which you can
116-
refer in other parts of your code it will also trigger the access decision manager when your
117-
actions are accessed by users and thus protect them from being accessed without the needed
118-
permissions.
111+
Using the ``@Acl`` annotation does not only create new access control lists to which you can refer in other parts of your code, it also triggers the access decision manager when your actions are accessed by users and thus protect them from being accessed without the needed permissions.
119112

120-
#. If you do not want to protect any controller methods or if you prefer to keep the definition of
121-
your ACLs separated from the application code, you can define them using some YAML config in a
122-
file named ``acls.yml``:
113+
#. If you do not want to protect any controller methods or if you prefer to keep the definition of your ACLs separated from the application code, you can define them using some YAML config in a file named ``acls.yml``:
123114

124115
.. code-block:: yaml
125116
:caption: src/Acme/Bundle/DemoBundle/Resources/config/oro/acls.yml
@@ -147,9 +138,7 @@ You have two options to define your custom access control lists:
147138
148139
.. sidebar:: Security Actions that Are not Related to an Entity
149140

150-
You can also create access control lists that are only used to protect certain actions that are
151-
not related to an entity. To do that just set the type of the ACL to ``action`` instead of
152-
``entity``:
141+
You can also create access control lists that are only used to protect specific actions unrelated to an entity. To do that, set the type of the ACL to ``action`` instead of ``entity``:
153142

154143
.. code-block:: php
155144
:caption: src/Acme/Bundle/DemoBundle/Controller/PageController.php
@@ -173,8 +162,7 @@ You have two options to define your custom access control lists:
173162
}
174163
}
175164
176-
When configuring the ACL using the YAML config format, you also have to set the controller to
177-
bind the ACL to using the ``bindings`` option:
165+
When configuring the ACL using the YAML config format, you also have to set the controller to use the ``bindings`` option to bind the ACL:
178166

179167
.. code-block:: yaml
180168
:caption: src/Acme/Bundle/DemoBundle/Resources/config/oro/acls.yml
@@ -197,13 +185,10 @@ You have two options to define your custom access control lists:
197185
Performing Access Checks
198186
------------------------
199187

200-
Once you have configured the ACLs you can protect all parts of your application. Anywhere in your
201-
PHP code you can use the ``isGranted()`` method of the ``security.authorization_checker`` service
202-
(which is an instance of the |Symfony AuthorizationCheckerInterface|):
188+
Once you have configured the ACLs, you can protect all application parts. You can use the ``isGranted()`` method of the ``security.authorization_checker`` service (which is an instance of the |Symfony AuthorizationCheckerInterface|) anywhere in your PHP code:
203189

204190
.. code-block:: php
205191
206-
207192
$authorizationChecker = $this->get('security.authorization_checker');
208193
209194
if ($authorizationChecker->isGranted('acme_static_pages')) {
@@ -214,7 +199,6 @@ You can set the second parameter to check access on Object level (with Access Le
214199

215200
.. code-block:: php
216201
217-
218202
$taskEntity = $this->getTask();
219203
220204
$authorizationChecker = $this->get('security.authorization_checker');
@@ -223,12 +207,10 @@ You can set the second parameter to check access on Object level (with Access Le
223207
// do something when the user is granted permissions for the acme_task_edit ACL of the entity in $taskEntity
224208
}
225209
226-
In case if you does not have proper ACL annotation, you can set the first parameter as the
227-
permission name you want to check:
210+
When you do not have proper ACL annotation, you can set the first parameter as the permission name you want to check:
228211

229212
.. code-block:: php
230213
231-
232214
$taskEntity = $this->getTask();
233215
234216
$authorizationChecker = $this->get('security.authorization_checker');
@@ -237,15 +219,14 @@ permission name you want to check:
237219
// do something when the user is granted EDIT permission for the $taskEntity
238220
}
239221
240-
This example will work the same as before. It will check an EDIT permission for the Task instance object.
222+
This example will work the same as before. It will check EDIT permission for the Task instance object.
241223

242-
However, there are ways to make this checks in different parts of your application:
224+
However, there are ways to perform these checks in different parts of your application:
243225

244226
Hiding Menu Items
245227
~~~~~~~~~~~~~~~~~
246228

247-
Use the ``acl_resource_id`` option to hide navigation items from users who are not granted to access
248-
the action being linked. The value of this option is the name of the ACL to check for:
229+
Use the ``acl_resource_id`` option to hide navigation items from users who are not granted access to the linked action. The value of this option is the name of the ACL to check for:
249230

250231
.. code-block:: yaml
251232
:caption: src/Acme/Bundle/DemoBundle/Resources/config/oro/navigation.yml
@@ -257,12 +238,10 @@ the action being linked. The value of this option is the name of the ACL to chec
257238
route: acme_task_index
258239
acl_resource_id: acme_task_view
259240
260-
Protecting Controllers Refering to Existing ACLs
261-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241+
Protecting Controllers Referring to Existing ACLs
242+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262243

263-
As :ref:`shown above <cookbook-entity-acl-controller>` you can define new ACLs and protect your
264-
controllers with them in a single step using the ``@Acl`` annotation. However, you can also refer
265-
to an existing access control list using the ``@AclAncestor`` annotation:
244+
You can define new ACLs as :ref:`shown above <cookbook-entity-acl-controller>` and protect your controllers with them in a single step using the ``@Acl`` annotation. However, you can also refer to an existing access control list using the ``@AclAncestor`` annotation:
266245

267246
.. code-block:: php
268247
:caption: src/Acme/Bundle/DemoBundle/Controller/TaskController.php
@@ -287,8 +266,7 @@ to an existing access control list using the ``@AclAncestor`` annotation:
287266
Show Parts of Templates Based on Permissions
288267
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
289268

290-
Inside your templates you can use the ``is_granted()`` Twig function to check for certain
291-
permissions to hide parts of your views for users who do not have the required permissions:
269+
Inside your templates, you can use the ``is_granted()`` Twig function to check for certain permissions to hide parts of your views for users who do not have the required permissions:
292270

293271
.. code-block:: html+jinja
294272
:caption: src/Acme/Bundle/DemoBundle/Resources/views/Task/update.html.twig
@@ -299,42 +277,38 @@ permissions to hide parts of your views for users who do not have the required p
299277
{% endif %}
300278
{% endblock %}
301279

302-
In this example we check access by ACL annotation info without Object to test. So, ``is_granted`` will return
303-
true as result if user have any access level to EDIT permission to Task entity.
280+
In this example, we check access by ACL annotation info without an Object to test. So, ``is_granted`` will return true if the user has any access level to EDIT permission to the Task entity.
304281

305-
In case if you want to check access more deeply, you can set the entity instance as the second parameter of
306-
``is_granted()`` function:
282+
If you want to perform a deeper access check, you can set the entity instance as the second parameter of the ``is_granted()`` function:
307283

308284
.. code-block:: html+jinja
309285
:caption: src/Acme/Bundle/DemoBundle/Resources/views/Task/update.html.twig
310286

311287
{% block someBlock %}
312-
{# an `entity` variable contains an Test entity instance #}
288+
{# an `entity` variable contains a Test entity instance #}
313289
{% if is_granted('acme_task_edit', entity) %}
314290
Some info if access is granted
315291
{% endif %}
316292
{% endblock %}
317293

318-
At this example, will be checked access level for the given object instance.
294+
This example illustrates the check of the access level for the given object instance.
319295

320-
In case if you have no an ACL annotation, you can set the permission name directly as the first parameter:
296+
If you have no ACL annotation, you can set the permission name directly as the first parameter:
321297

322298
.. code-block:: html+jinja
323299
:caption: src/Acme/Bundle/DemoBundle/Resources/views/Task/update.html.twig
324300

325301
{% block someBlock %}
326-
{# an `entity` variable contains an Test entity instance #}
302+
{# an `entity` variable contains a Test entity instance #}
327303
{% if is_granted('EDIT', entity) %}
328304
Some info if access is granted
329305
{% endif %}
330306
{% endblock %}
331307

332-
333308
Restrict Access to Data Grid Results
334309
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335310

336-
In a data grid you can protect the entire result set (to not show results if the user is not
337-
granted access and the action embedding the grid accidentally was not protected):
311+
In a data grid, you can protect the entire result set (not to show results if the user is not granted access and the action embedding the grid was not protected by accident):
338312

339313
.. code-block:: yaml
340314
:caption: src/Acme/Bundle/DemoBundle/Resources/config/oro/datagrids.yml
@@ -349,8 +323,7 @@ granted access and the action embedding the grid accidentally was not protected)
349323
Hide Unaccessible Grid Actions
350324
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
351325

352-
Also use the ``acl_resource`` option to hide actions in a data grid the user does not have access
353-
to:
326+
You can also use the ``acl_resource`` option to hide actions in a data grid the user does not have access to:
354327

355328
.. code-block:: yaml
356329
:caption: src/Acme/Bundle/DemoBundle/Resources/config/oro/datagrids.yml
@@ -376,7 +349,7 @@ to:
376349
Check Access on ORM Queries
377350
~~~~~~~~~~~~~~~~~~~~~~~~~~~
378351

379-
You can protect your Doctrine ORM query with ``apply`` method of ``oro_security.acl_helper`` service.
352+
You can protect your Doctrine ORM query with the ``apply`` method of the ``oro_security.acl_helper`` service.
380353

381354
.. code-block:: php
382355
@@ -407,11 +380,9 @@ You can protect your Doctrine ORM query with ``apply`` method of ``oro_security.
407380
}
408381
}
409382
410-
As result, the query will be modified and the result data set will contain only the records user can see.
411-
412-
By default, VIEW permission used as the second parameter. If you want to check another permission, you can
413-
set it as the second parameter of ``apply`` method.
383+
As a result, the query will be modified, and the result data set will contain only the records the user can see.
414384

385+
By default, VIEW permission is used as the second parameter. If you want to check another permission, you can set it as the second parameter of the ``apply`` method.
415386

416387
.. include:: /include/include-links-dev.rst
417-
:start-after: begin
388+
:start-after: begin

backend/entities/attachments.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ Configurable entities can use attachments for adding additional files to their r
77

88
To enable attachments for an entity, an administrator should enable them in the current entity configuration.
99

10-
Additionally, admin can set array with allowed mine types and maximum sizes of the attached files.
10+
Additionally, the admin can set an array with allowed mine types and maximum sizes of the attached files.
1111

1212
If no mime types were set, the mime types from ``Upload settings`` (system configuration) are used for validation.
1313

1414
Once the schema is updated, the **Add attachment** button becomes available for the current entity.
1515

1616
For the detailed information on the attachments that configurable entities can use, refer to the :ref:`OroAttachmentBundle <bundle-docs-platform-attachment-bundle>` topic.
1717

18-
1918
.. include:: /include/include-links-dev.rst
20-
:start-after: begin
19+
:start-after: begin

0 commit comments

Comments
 (0)