8000 Update voters.rst · symfony/symfony-docs@8c1576b · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c1576b

Browse files
ThomasLandauerjaviereguiluz
authored andcommitted
Update voters.rst
1 parent b0e2521 commit 8c1576b

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

security/voters.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ would look like this::
125125
return false;
126126
}
127127

128-
// only vote on Post objects inside this voter
128+
// only vote on `Post` objects
129129
if (!$subject instanceof Post) {
130130
return false;
131131
}
@@ -142,7 +142,7 @@ would look like this::
142142
return false;
143143
}
144144

145-
// you know $subject is a Post object, thanks to supports
145+
// you know $subject is a Post object, thanks to `supports()`
146146
/** @var Post $post */
147147
$post = $subject;
148148

@@ -163,15 +163,13 @@ would look like this::
163163
return true;
164164
}
165165

166-
// the Post object could have, for example, a method isPrivate()
167-
// that checks a boolean $private property
166+
// the Post object could have, for example, a method `isPrivate()`
168167
return !$post->isPrivate();
169168
}
170169

171170
private function canEdit(Post $post, User $user)
172171
{
173-
// this assumes that the data object has a getOwner() method
174-
// to get the entity of the user who owns this data object
172+
// this assumes that the Post object has a `getOwner()` method
175173
return $user === $post->getOwner();
176174
}
177175
}
@@ -271,9 +269,8 @@ voters vote for one action and object. For instance, suppose you have one voter
271269
checks if the user is a member of the site and a second one that checks if the user
272270
is older than 18.
273271

274-
To handle these cases, the access decision manager uses an access decision
275-
strategy. You can configure this to suit your needs. There are three
276-
strategies available:
272+
To handle these cases, the access decision manager uses a "strategy" which you can configure.
273+
There are three strategies available:
277274

278275
``affirmative`` (default)
279276
This grants access as soon as there is *one* voter granting access;

0 commit comments

Comments
 (0)
0