Skip to content

Instantly share code, notes, and snippets.

@nkgokul
Created July 9, 2019 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkgokul/4ebc8d15826891f717b2815a0d516511 to your computer and use it in GitHub Desktop.
Save nkgokul/4ebc8d15826891f717b2815a0d516511 to your computer and use it in GitHub Desktop.
Drupal Get Roles that have a permission
$roles = \Drupal::entityTypeManager()->getStorage('user_role')->loadMultiple();
//dpm($roles);
foreach($roles as $role){
if($role->hasPermission('use sourcex transition keep_in_pending_publishing')){
dpm($role->label());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment