8000 Merge branch '4.4' into 5.0 · symfony/symfony-docs@d52691a · GitHub
[go: up one dir, main page]

Skip to content

Commit d52691a

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Update voters.rst Update guard_authentication.rst
2 parents fabcc60 + 14fc86c commit d52691a

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

security/guard_authentication.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,13 @@ The Guard Authenticator Methods
275275
Each authenticator needs the following methods:
276276

277277
**supports(Request $request)**
278-
This will be called on *every* request and your job is to decide if the
278+
This is called on *every* request and your job is to decide if the
279279
authenticator should be used for this request (return ``true``) or if it
280280
should be skipped (return ``false``).
281281

282282
**getCredentials(Request $request)**
283-
This will be called on *every* request and your job is to read the token (or
284-
whatever your "authentication" information is) from the request and return it.
285-
These credentials are later passed as the first argument of ``getUser()``.
283+
Your job is to read the token (or whatever your "authentication" information is)
284+
from the request and return it. These credentials are passed to ``getUser()``.
286285

287286
**getUser($credentials, UserProviderInterface $userProvider)**
288287
The ``$credentials`` argument is the value returned by ``getCredentials()``.

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
}
@@ -261,9 +259,8 @@ voters vote for one action and object. For instance, suppose you have one voter
261259
checks if the user is a member of the site and a second one that checks if the user
262260
is older than 18.
263261

264-
To handle these cases, the access decision manager uses an access decision
265-
strategy. You can configure this to suit your needs. There are three
266-
strategies available:
262+
To handle these cases, the access decision manager uses a "strategy" which you can configure.
263+
There are three strategies available:
267264

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

0 commit comments

Comments
 (0)
0