@@ -90,7 +90,7 @@ might ultimately looks like this:
90
90
<!-- src/Acme/SecurityBundle/Resources/views/Security/login.html.php -->
91
91
<?php if ($error): ?>
92
92
<div><?php echo $error->getMessage() ?></div>
93
- <?php endif; ?>
93
+ <?php endif ?>
94
94
95
95
<form action="<?php echo $view['router']->generate('login_check') ?>" method="post">
96
96
<label for="username">Username:</label>
@@ -162,7 +162,7 @@ In the following example, the action is only allowed if the user has the
162
162
163
163
public function editAction()
164
164
{
165
- if (false === $this->get('security.context ')->isGranted(
165
+ if (false === $this->get('security.authorization_checker ')->isGranted(
166
166
'IS_AUTHENTICATED_FULLY'
167
167
)) {
168
168
throw new AccessDeniedException();
@@ -171,21 +171,29 @@ In the following example, the action is only allowed if the user has the
171
171
// ...
172
172
}
173
173
174
- You can also choose to install and use the optional JMSSecurityExtraBundle _,
175
- which can secure your controller using annotations:
174
+ .. versionadded :: 2.6
175
+ The ``security.authorization_checker `` service was introduced in Symfony 2.6. Prior
176
+ to Symfony 2.6, you had to use the ``isGranted() `` method of the ``security.context `` service.
177
+
178
+ If your application is based on the Symfony Standard Edition, you can also secure
179
+ your controller using annotations:
176
180
177
181
.. code-block :: php
178
182
179
- use JMS\SecurityExtraBundle\Annotation\Secure ;
183
+ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security ;
180
184
181
185
/**
182
- * @Secure(roles=" IS_AUTHENTICATED_FULLY")
186
+ * @Security("has_role(' IS_AUTHENTICATED_FULLY') ")
183
187
*/
184
188
public function editAction($name)
185
189
{
186
190
// ...
187
191
}
188
192
193
+ .. versionadded :: 2.4
194
+ The ``@Security `` annotation was introduced in SensioFrameworkExtraBundle 3.0,
195
+ which can only be used with Symfony 2.4 or later.
196
+
189
197
.. tip ::
190
198
191
199
If you also had an access control in your security configuration that
@@ -208,5 +216,3 @@ which can secure your controller using annotations:
208
216
209
217
For more information on securing services or methods in this way,
210
218
see :doc: `/cookbook/security/securing_services `.
211
-
212
- .. _JMSSecurityExtraBundle : https://github.com/schmittjoh/JMSSecurityExtraBundle
0 commit comments