Skip to content

Instantly share code, notes, and snippets.

@segovia94
Created January 27, 2015 01:25
Show Gist options
  • Save segovia94/687f7f7d567543eab7a6 to your computer and use it in GitHub Desktop.
Save segovia94/687f7f7d567543eab7a6 to your computer and use it in GitHub Desktop.
Get a list of Drupal permissions
<?php
// Print a list of all set permissions.
// You can then copy the output from the website source code and paste it into a php array.
$user_roles = user_roles();
$roles = user_role_permissions($user_roles);
foreach ($roles as $rid => $permissions) {
print "\n\n" . $user_roles[$rid] . "\n";
foreach ($permissions as $permission => $bool) {
print "'" . $permission . "',\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment