diff --git a/developer_manual/basics/controllers.rst b/developer_manual/basics/controllers.rst index 5b34aa585..9f1ea73d4 100644 --- a/developer_manual/basics/controllers.rst +++ b/developer_manual/basics/controllers.rst @@ -825,6 +825,77 @@ To turn off checks the following *Attributes* can be added before the controller * ``@NoTwoFactorRequired``` instead of ``#[NoTwoFactorRequired]`` * ``@NoCSRFRequired``` instead of ``#[NoCSRFRequired]`` +In the following some examples of configurations are given. + +Showing an HTML page by the user +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A typical app needs an ``index.html`` page to show all content within. +This page should be visible by all users in the instance. +Therefore, you need to loosen the restriction from admins only (``#[NoAdminRequired]``). +Additionally, as the user might not have a CSRF checker cookie set yet, the CSRF checks should be disabled (which is fine as this is a template response). + +.. code-block:: php + + appName, 'main'); + } + + } + +If the page should only be visible to the admin, you can keep the restrictive default by omitting the attribute ``#[NoAdminRequired]``. + +Getting data from the backend using AJAX requests +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Data for the frontend needs to be made available from the backend. +Here, OCS is the suggested way to go. +Here is the example from :ref:`OCS controllers `: + +.. code-block:: php + +