March 2019
Intermediate to advanced
580 pages
15h 3m
English
You can easily check whether a given user should access a certain resource as long as you have that user account at hand. Here, you can encounter two scenarios:
As we saw in Chapter 2, Creating Your First Module, the current user is represented by a service that implements the AccountProxyInterface interface. This service can be accessed by the current_user key or statically with this shorthand:
$accountProxy = \Drupal::currentUser();
From this account proxy we can request the AccountInterface which represents the actual logged-in user account (the UserSession object). It holds a reference to ...
Read now
Unlock full access