@@ -104,12 +104,12 @@ edit a particular object. Here's an example implementation::
104
104
*/
105
105
public function vote(TokenInterface $token, $post, array $attributes)
106
106
{
107
- // check if class of this object is supported by this voter
107
+ // check if the class of this object is supported by this voter
108
108
if (!$this->supportsClass(get_class($post))) {
109
109
return VoterInterface::ACCESS_ABSTAIN;
110
110
}
111
111
112
- // check if the voter is used correct , only allow one attribute
112
+ // check if the voter is used correctly , only allow one attribute
113
113
// this isn't a requirement, it's just one easy way for you to
114
114
// design your voter
115
115
if (1 !== count($attributes)) {
@@ -134,9 +134,8 @@ edit a particular object. Here's an example implementation::
134
134
return VoterInterface::ACCESS_DENIED;
135
135
}
136
136
137
- // double-check that the User object is the expected entity.
138
- // It always will be, unless there is some misconfiguration of the
139
- // security system.
137
+ // double-check that the User object is the expected entity (this
138
+ // only happens when you did not configure the security system properly)
140
139
if (!$user instanceof User) {
141
140
throw new \LogicException('The user is somehow not our User class!');
142
141
}
@@ -196,7 +195,8 @@ and tag it with ``security.voter``:
196
195
<services >
197
196
<service id =" security.access.post_voter"
198
197
class =" AppBundle\Security\Authorization\Voter\PostVoter"
199
- public =" false" >
198
+ public =" false"
199
+ >
200
200
201
201
<tag name =" security.voter" />
202
202
</service >
@@ -238,7 +238,7 @@ from the security context is called.
238
238
// get a Post instance
239
239
$post = ...;
240
240
241
- // keep in mind, this will call all registered security voters
241
+ // keep in mind that this will call all registered security voters
242
242
if (false === $this->get('security.context')->isGranted('view', $post)) {
243
243
throw new AccessDeniedException('Unauthorized access!');
244
244
}
0 commit comments