Skip to content
This repository was archived by the owner on Jul 26, 2018. It is now read-only.

Commit a1af4e5

Browse files
committed
Divided the docs into sections
1 parent 4a121ca commit a1af4e5

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,23 @@ class MyService
9191
List of Shortcuts
9292
-----------------
9393

94+
### Getting users
95+
9496
* `getUser()`: returns the current application user.
9597
* `getImpersonatingUser()`: when impersonating a user, it returns the original
9698
user who started the impersonation.
99+
100+
### Checking permissions
101+
97102
* `isGranted($attributes, $object = null)`: checks if the attributes (usually
98103
security roles) are granted for the current application user and the
99104
optionally given object.
100-
* `getLoginError()`: returns the error of the last failed login attempt, if any.
101-
* `getLoginUsername()`: returns the username of the last failed login attempt,
102-
if any.
103105
* `hasRole($role, $user = null)`: returns `true` if the current application user
104106
(or the optionally given user) has the given role. It takes into account the
105107
full role hierarchy.
108+
109+
### Types of users
110+
106111
* `isAnonymous($user = null)`: returns `true` if the current application user (or
107112
the optionally given user) is anonymous. This behaves differently than Symfony
108113
built-in methods and it returns `true` only when the user is really anonymous.
@@ -116,8 +121,17 @@ List of Shortcuts
116121
* `isAuthenticated($user = null)`: returns `true` if the current application user
117122
(or the optionally given user) is authenticated in any way (because they have
118123
introduced their credentials (username and password) or they have been remembered).
124+
125+
### Login
126+
119127
* `login(UserInterface $user, $firewallName = 'main')`: it logs in the given user
120128
in the `main` application firewall (or the optionally given firewall name).
129+
* `getLoginError()`: returns the error of the last failed login attempt, if any.
130+
* `getLoginUsername()`: returns the username of the last failed login attempt,
131+
if any.
132+
133+
### Passwords
134+
121135
* `encodePassword($plainPassword, $user = null)`: returns the given plain
122136
password encoded/hashed using the encoder of the current application user or
123137
the optionally given user.

0 commit comments

Comments
 (0)