Created
July 20, 2016 15:15
-
-
Save scottalan/d63bd8e012946e37b1b1f0b146105b19 to your computer and use it in GitHub Desktop.
Drupal8: Current user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // How to check for permission in Drupal 8 | |
| // Get the current user | |
| $user = \Drupal::currentUser(); | |
| // Check for permission | |
| $user->hasPermission('access administration menu'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment