2020 * @property-read mixed $id
2121 * @property-read array $roles
2222 * @property-read int $logoutReason
23- * @property IAuthenticator $authenticator
24- * @property IAuthorizator $authorizator
23+ * @property Authenticator $authenticator
24+ * @property Authorizator $authorizator
2525 */
2626class User
2727{
2828 use Nette \SmartObject;
2929
3030 /** @deprecated */
3131 public const
32- MANUAL = IUserStorage ::MANUAL ,
33- INACTIVITY = IUserStorage ::INACTIVITY ;
32+ MANUAL = UserStorage ::MANUAL ,
33+ INACTIVITY = UserStorage ::INACTIVITY ;
3434
3535 /** @var string default role for unauthenticated user */
3636 public $ guestRole = 'guest ' ;
@@ -44,13 +44,13 @@ class User
4444 /** @var callable[] function (User $sender): void; Occurs when the user is logged out */
4545 public $ onLoggedOut ;
4646
47- /** @var IUserStorage Session storage for current user */
47+ /** @var UserStorage Session storage for current user */
4848 private $ storage ;
4949
50- /** @var IAuthenticator |null */
50+ /** @var Authenticator |null */
5151 private $ authenticator ;
5252
53- /** @var IAuthorizator |null */
53+ /** @var Authorizator |null */
5454 private $ authorizator ;
5555
5656 /** @var IIdentity|false|null false means undefined */
@@ -61,17 +61,17 @@ class User
6161
6262
6363 public function __construct (
64- IUserStorage $ storage ,
65- IAuthenticator $ authenticator = null ,
66- IAuthorizator $ authorizator = null
64+ UserStorage $ storage ,
65+ Authenticator $ authenticator = null ,
66+ Authorizator $ authorizator = null
6767 ) {
6868 $ this ->storage = $ storage ;
6969 $ this ->authenticator = $ authenticator ;
7070 $ this ->authorizator = $ authorizator ;
7171 }
7272
7373
74- final public function getStorage (): IUserStorage
74+ final public function getStorage (): UserStorage
7575 {
7676 return $ this ->storage ;
7777 }
@@ -155,7 +155,7 @@ public function getId()
155155 * Sets authentication handler.
156156 * @return static
157157 */
158- public function setAuthenticator (IAuthenticator $ handler )
158+ public function setAuthenticator (Authenticator $ handler )
159159 {
160160 $ this ->authenticator = $ handler ;
161161 return $ this ;
@@ -165,7 +165,7 @@ public function setAuthenticator(IAuthenticator $handler)
165165 /**
166166 * Returns authentication handler.
167167 */
168- final public function getAuthenticator (): ?IAuthenticator
168+ final public function getAuthenticator (): ?Authenticator
169169 {
170170 if (func_num_args ()) {
171171 trigger_error (__METHOD__ . '() parameter $throw is deprecated, use getAuthenticatorIfExists() ' , E_USER_DEPRECATED );
@@ -181,7 +181,7 @@ final public function getAuthenticator(): ?IAuthenticator
181181 /**
182182 * Returns authentication handler.
183183 */
184- final public function getAuthenticatorIfExists (): ?IAuthenticator
184+ final public function getAuthenticatorIfExists (): ?Authenticator
185185 {
186186 return $ this ->authenticator ;
187187 }
@@ -195,14 +195,14 @@ final public function hasAuthenticator(): bool
195195
196196
197197 /**
198- * Enables log out after inactivity (like '20 minutes'). Accepts flag IUserStorage ::CLEAR_IDENTITY.
198+ * Enables log out after inactivity (like '20 minutes'). Accepts flag UserStorage ::CLEAR_IDENTITY.
199199 * @param string|null $expire
200200 * @param int $flags
201201 * @return static
202202 */
203203 public function setExpiration ($ expire , /*int*/ $ flags = 0 )
204204 {
205- $ clearIdentity = $ flags === IUserStorage ::CLEAR_IDENTITY ;
205+ $ clearIdentity = $ flags === UserStorage ::CLEAR_IDENTITY ;
206206 if ($ expire !== null && !is_string ($ expire )) {
207207 trigger_error ("Expiration should be a string like '20 minutes' etc. " , E_USER_DEPRECATED );
208208 }
@@ -211,9 +211,9 @@ public function setExpiration($expire, /*int*/$flags = 0)
211211 }
212212 if (func_num_args () > 2 ) {
213213 $ clearIdentity = $ clearIdentity || func_get_arg (2 );
214- trigger_error (__METHOD__ . '() third parameter is deprecated, use flag setExpiration($time, IUserStorage ::CLEAR_IDENTITY) ' , E_USER_DEPRECATED );
214+ trigger_error (__METHOD__ . '() third parameter is deprecated, use flag setExpiration($time, UserStorage ::CLEAR_IDENTITY) ' , E_USER_DEPRECATED );
215215 }
216- $ this ->storage ->setExpiration ($ expire , $ clearIdentity ? IUserStorage ::CLEAR_IDENTITY : 0 );
216+ $ this ->storage ->setExpiration ($ expire , $ clearIdentity ? UserStorage ::CLEAR_IDENTITY : 0 );
217217 return $ this ;
218218 }
219219
@@ -257,7 +257,7 @@ final public function isInRole(string $role): bool
257257 * Has a user effective access to the Resource?
258258 * If $resource is null, then the query applies to all resources.
259259 */
260- public function isAllowed ($ resource = IAuthorizator ::ALL , $ privilege = IAuthorizator ::ALL ): bool
260+ public function isAllowed ($ resource = Authorizator ::ALL , $ privilege = Authorizator ::ALL ): bool
261261 {
262262 foreach ($ this ->getRoles () as $ role ) {
263263 if ($ this ->getAuthorizator ()->isAllowed ($ role , $ resource , $ privilege )) {
@@ -273,7 +273,7 @@ public function isAllowed($resource = IAuthorizator::ALL, $privilege = IAuthoriz
273273 * Sets authorization handler.
274274 * @return static
275275 */
276- public function setAuthorizator (IAuthorizator $ handler )
276+ public function setAuthorizator (Authorizator $ handler )
277277 {
278278 $ this ->authorizator = $ handler ;
279279 return $ this ;
@@ -283,7 +283,7 @@ public function setAuthorizator(IAuthorizator $handler)
283283 /**
284284 * Returns current authorization handler.
285285 */
286- final public function getAuthorizator (): ?IAuthorizator
286+ final public function getAuthorizator (): ?Authorizator
287287 {
288288 if (func_num_args ()) {
289289 trigger_error (__METHOD__ . '() parameter $throw is deprecated, use getAuthorizatorIfExists() ' , E_USER_DEPRECATED );
@@ -299,7 +299,7 @@ final public function getAuthorizator(): ?IAuthorizator
299299 /**
300300 * Returns current authorization handler.
301301 */
302- final public function getAuthorizatorIfExists (): ?IAuthorizator
302+ final public function getAuthorizatorIfExists (): ?Authorizator
303303 {
304304 return $ this ->authorizator ;
305305 }
0 commit comments