Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Controller matching in the access control rules section #102

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
540223e
updated access control rules for matching a controller
Feb 14, 2011
e738be1
fixed the regex
Feb 14, 2011
1eed3e7
added Japanese translation of 01-The-Big-Picture.markdown
masakielastic Mar 17, 2010
5522f3d
[service_container] Initial import of the service container guide and…
weaverryan Feb 12, 2011
45e44a3
[reference] Bootstrapping the reference section.
weaverryan Feb 13, 2011
2b6003b
[service_container] Renaming everything to "Service Container", which…
weaverryan Feb 14, 2011
d6cb61a
[service_container] Fixing typo per Stof.
weaverryan Feb 14, 2011
7b1daa2
added missing files in the sandbox
fabpot Jun 30, 2010
543441b
added missing assets
fabpot Sep 16, 2010
c963d90
updated Templates and Final Thoughts
chaffneue Feb 6, 2011
27bf398
rephrasing Creating your first Application
ckwalsh Feb 5, 2011
c2998e9
updated Configuration
chaffneue Feb 5, 2011
bea2a8a
Improving Working with Environments
ckwalsh Feb 6, 2011
450e764
Better describing controllers
ckwalsh Feb 6, 2011
5aa1cde
updated Checking the Configuration
chaffneue Feb 5, 2011
0642e48
[Testing] fixed Form object retrieval with the Crawler instance
Feb 11, 2011
c31d60a
fixed typo
hidenorigoto Feb 12, 2011
80849f0
[Forms] Fixing an inline link by using the :ref: linking syntax.
weaverryan Feb 13, 2011
de617f6
[markup] Fixing two minor markup issues.
weaverryan Feb 13, 2011
2f97910
[Forms] Adding missing link to the form fields guide.
weaverryan Feb 13, 2011
1b0399c
[Forms] Reorganizing the form fields section to use a map file and ad…
weaverryan Feb 13, 2011
57bd1aa
updated Routing
chaffneue Feb 6, 2011
0f66b96
[quick_tour] Clarifying the namespace versus bundle name use in the c…
weaverryan Feb 11, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contributing/code/conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ When an object has a "main" many relation with related "things"
The usage of these methods are only allowed when it is clear that there
is a main relation:

* a ``CookieJar`` has many ``Cookie``s;
* a ``CookieJar`` has many ``Cookie`` objects;

* a Service ``Container`` has many services and many parameters (as services
is the main relation, we use the naming convention for this relation);
Expand Down
2 changes: 1 addition & 1 deletion contributing/code/patches.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Check that all tests still pass and push your branch remotely:
You can now discuss your patch on the `dev mailing-list`_ or make a pull
request (they must be done on the ``fabpot/symfony`` repository).

If you are going to send and email to the mailing-list, don't forget to
If you are going to send an email to the mailing-list, don't forget to
reference you branch URL (``http://github.com/USERNAME/symfony.git
BRANCH_NAME``).

Expand Down
18 changes: 17 additions & 1 deletion glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,20 @@ Glossary
A *Front Controller* is a short PHP that lives in the web directory
of your project. Typically, *all* requests are handled by executing
the same front controller, whose job is to bootstrap the Symfony
application.
application.

Service
A *Service* is a generic term for any PHP object that performs a
specific task. In Symfony2, services are often configured and retrieved
from the service container. An application that has many decoupled
services is said to follow a `service-oriented architecture`_

Service Container
A *Service Container*, also known as a *Dependency Injection Container*,
is a special object that manages the instantiation of services inside
an application. Instead of creating services directly, the developer
*trains* the service container (via configuration) on how to create
the services. The service container takes care of lazily instantiating
and injecting dependent services.

.. _`service-oriented architecture`: http://wikipedia.org/wiki/Service-oriented_architecture
29 changes: 5 additions & 24 deletions guides/forms/fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ this initial value, you can set it in the ``data`` option.

When you set the ``data`` option, the field will also not write the the
domain object, because the ``property_path`` option will implicitely be
``null``. Read ```property_path```_ for more information.
``null``. Read :ref:`form-field-property_path` for more information.

``required``
~~~~~~~~~~~~
Expand Down Expand Up @@ -92,6 +92,8 @@ set the ``trim`` option to ``false``.

assert(' Data ' === $field->getData());

.. _form-field-property_path:

``property_path``
~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -212,26 +214,5 @@ Symfony2 ships with the following fields:

fields/index

* :doc:`BirthdayField <fields/BirthdayField>`
* :doc:`CheckboxField <fields/CheckboxField>`
* :doc:`ChoiceField <fields/ChoiceField>`
* :doc:`CollectionField <fields/CollectionField>`
* :doc:`CountryField <fields/CountryField>`
* :doc:`DateField <fields/DateField>`
* :doc:`DateTimeField <fields/DateTimeField>`
* :doc:`EntityChoiceField <fields/EntityChoiceField>`
* :doc:`FileField <fields/FileField>`
* :doc:`HiddenField <fields/HiddenField>`
* :doc:`IntegerField <fields/IntegerField>`
* :doc:`LanguageField <fields/LanguageField>`
* :doc:`LocaleField <fields/LocaleField>`
* :doc:`MoneyField <fields/MoneyField>`
* :doc:`NumberField <fields/NumberField>`
* :doc:`PasswordField <fields/PasswordField>`
* :doc:`PercentField <fields/PercentField>`
* :doc:`RepeatedField <fields/RepeatedField>`
* :doc:`TextareaField <fields/TextareaField>`
* :doc:`TextField <fields/TextField>`
* :doc:`TimeField <fields/TimeField>`
* :doc:`TimezoneField <fields/TimezoneField>`
* :doc:`UrlField <fields/UrlField>`
.. include:: fields/map.rst.inc

5 changes: 5 additions & 0 deletions guides/forms/fields/BirthdayField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BirthdayField
=============

Documentation for the :class:`Symfony\\Component\\Form\\BirthdayField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/CheckboxField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CheckboxField
=============

Documentation for the :class:`Symfony\\Component\\Form\\CheckboxField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/ChoiceField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ChoiceField
===========

Documentation for the :class:`Symfony\\Component\\Form\\ChoiceField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/CountryField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CountryField
============

Documentation for the :class:`Symfony\\Component\\Form\\CountryField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/DateField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DateField
=========

Documentation for the :class:`Symfony\\Component\\Form\\DateField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/DateTimeField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DateTimeField
=============

Documentation for the :class:`Symfony\\Component\\Form\\DateTimeField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/EntityChoiceField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
EntityChoiceField
=================

Documentation for the :class:`Symfony\\Component\\Form\\EntityChoiceField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/FileField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FileField
=========

Documentation for the :class:`Symfony\\Component\\Form\\FileField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/HiddenField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HiddenField
===========

Documentation for the :class:`Symfony\\Component\\Form\\HiddenField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/IntegerField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IntegerField
============

Documentation for the :class:`Symfony\\Component\\Form\\IntegerField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/LanguageField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LanguageField
=============

Documentation for the :class:`Symfony\\Component\\Form\\LanguageField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/LocaleField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LocaleField
===========

Documentation for the :class:`Symfony\\Component\\Form\\LocaleField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/MoneyField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MoneyField
==========

Documentation for the :class:`Symfony\\Component\\Form\\MoneyField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/NumberField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NumberField
===========

Documentation for the :class:`Symfony\\Component\\Form\\NumberField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/PasswordField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PasswordField
=============

Documentation for the :class:`Symfony\\Component\\Form\\PasswordField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/PercentField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PercentField
============

Documentation for the :class:`Symfony\\Component\\Form\\PercentField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/TextField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TextField
=========

Documentation for the :class:`Symfony\\Component\\Form\\TextField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/TextareaField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TextareaField
=============

Documentation for the :class:`Symfony\\Component\\Form\\TextareaField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/TimeField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TimeField
=========

Documentation for the :class:`Symfony\\Component\\Form\\TimeField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/TimezoneField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TimezoneField
=============

Documentation for the :class:`Symfony\\Component\\Form\\TimezoneField`
class is currently only available via the generated API.
5 changes: 5 additions & 0 deletions guides/forms/fields/UrlField.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
UrlField
========

Documentation for the :class:`Symfony\\Component\\Form\\UrlField`
class is currently only available via the generated API.
34 changes: 34 additions & 0 deletions guides/forms/fields/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Built-in Fields
===============

Symfony2 ships with the following fields:

.. toctree::
:maxdepth: 2
:hidden:

BirthdayField
CheckboxField
ChoiceField
CollectionField
CountryField
DateField
DateTimeField
EntityChoiceField
FileField
HiddenField
IntegerField
LanguageField
LocaleField
MoneyField
NumberField
PasswordField
PercentField
RepeatedField
TextareaField
TextField
TimeField
TimezoneField
UrlField

.. include:: map.rst.inc
23 changes: 23 additions & 0 deletions guides/forms/fields/map.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
* :doc:`BirthdayField </guides/forms/fields/BirthdayField>`
* :doc:`CheckboxField </guides/forms/fields/CheckboxField>`
* :doc:`ChoiceField </guides/forms/fields/ChoiceField>`
* :doc:`CollectionField </guides/forms/fields/CollectionField>`
* :doc:`CountryField </guides/forms/fields/CountryField>`
* :doc:`DateField </guides/forms/fields/DateField>`
* :doc:`DateTimeField </guides/forms/fields/DateTimeField>`
* :doc:`EntityChoiceField </guides/forms/fields/EntityChoiceField>`
* :doc:`FileField </guides/forms/fields/FileField>`
* :doc:`HiddenField </guides/forms/fields/HiddenField>`
* :doc:`IntegerField </guides/forms/fields/IntegerField>`
* :doc:`LanguageField </guides/forms/fields/LanguageField>`
* :doc:`LocaleField </guides/forms/fields/LocaleField>`
* :doc:`MoneyField </guides/forms/fields/MoneyField>`
* :doc:`NumberField </guides/forms/fields/NumberField>`
* :doc:`PasswordField </guides/forms/fields/PasswordField>`
* :doc:`PercentField </guides/forms/fields/PercentField>`
* :doc:`RepeatedField </guides/forms/fields/RepeatedField>`
* :doc:`TextareaField </guides/forms/fields/TextareaField>`
* :doc:`TextField </guides/forms/fields/TextField>`
* :doc:`TimeField </guides/forms/fields/TimeField>`
* :doc:`TimezoneField </guides/forms/fields/TimezoneField>`
* :doc:`UrlField </guides/forms/fields/UrlField>`
1 change: 1 addition & 0 deletions guides/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Dive into Symfony2 with the topical guides:
event/index
tools/index
bundles/index
service_container/index
internals/index
symfony1
stable_api
Expand Down
2 changes: 1 addition & 1 deletion guides/internals/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Dependency Injection component and a powerful plugin system (bundles).
.. seealso::

Read more about the :doc:`HttpKernel <kernel>` component. Read more about
:doc:`Dependency Injection </guides/dependency_injection/index>` and
:doc:`Dependency Injection </guides/service_container/index>` and
:doc:`Bundles </guides/bundles/index>`.

``FrameworkBundle`` Bundle
Expand Down
8 changes: 5 additions & 3 deletions guides/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
* **Forms**:

* :doc:`Overview </guides/forms/overview>` |
* :doc:`Templates </guides/forms/view>`
* :doc:`Templates </guides/forms/view>` |
* :doc:`Form Fields </guides/forms/fields>`

* **Security**:

Expand Down Expand Up @@ -63,9 +64,10 @@
* :doc:`Best Practices </guides/bundles/best_practices>` |
* :doc:`Configuration </guides/bundles/configuration>`

* **Dependency Injection**:
* **Service Container**:

* :doc:`Extensions </guides/dependency_injection/extensions>`
* :doc:`Service Container </guides/service_container/index>`
* :doc:`Extensions </guides/service_container/extensions>`

* **Internals**:

Expand Down
20 changes: 14 additions & 6 deletions guides/security/authorization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,15 @@ Access control rules can match a request in many different ways:
- { path: /admin/.*, role: ROLE_ADMIN }

# match the controller class name
- { controller: .*\\.*Bundle\\Admin\\.*, role: ROLE_ADMIN }
-
attributes:
_controller: '.*Bundle\\\.*\\\Admin.*'
role: ROLE_ADMIN

# match any request attribute
-
attributes:
- { key: _controller, pattern: .*\\.*Bundle\\Admin\\.* }
- { key: _controller, pattern: '.*Bundle\\\.*\\\Admin.*' }
role: ROLE_ADMIN

.. code-block:: xml
Expand All @@ -98,11 +101,13 @@ Access control rules can match a request in many different ways:
<rule path="/admin/.*" role="ROLE_ADMIN" />

<!-- match the controller class name -->
<rule controller=".*\\.*Bundle\\Admin\\.*" role="ROLE_ADMIN" />
<rule role="ROLE_ADMIN">
<attribute key="_controller" pattern=".*Bundle\\\.*\\\Admin.*" />
</rule>

<!-- match any request attribute -->
<rule role="ROLE_ADMIN">
<attribute key="_controller" pattern=".*\\.*Bundle\\Admin\\.*" />
<attribute key="_controller" pattern=".*Bundle\\\.*\\\Admin.*" />
</rule>
</access-control>
</config>
Expand All @@ -116,12 +121,15 @@ Access control rules can match a request in many different ways:
array('path' => '/admin/.*', 'role' => 'ROLE_ADMIN'),

// match the controller class name
array('controller' => '.*\\.*Bundle\\Admin\\.*', 'role' => 'ROLE_ADMIN'),
array(
'attributes' => array('controller' => '.*Bundle\\\.*\\\Admin.*'),
'role' => 'ROLE_ADMIN'
),

// match any request attribute
array(
'attributes' => array(
array('key' => '_controller', 'pattern' => '.*\\.*Bundle\\Admin\\.*'),
array('key' => '_controller', 'pattern' => '.*Bundle\\\.*\\\Admin.*'),
),
'role' => 'ROLE_ADMIN',
),
Expand Down
Loading