Skip to content

Instantly share code, notes, and snippets.

@dergachev
Last active December 18, 2015 10:29
Show Gist options
  • Save dergachev/5769111 to your computer and use it in GitHub Desktop.
Save dergachev/5769111 to your computer and use it in GitHub Desktop.
Drupal Permissions bookmarklet

Drupal Permissions bookmarklet

Selects all permissions checkboxes for a given role.

To install, visit http://bl.ocks.org/dergachev/5769111

To use:

  • Visit http://drupal7site.com/admin/people/permissions
  • Run "Drupal Permissions" bookmarklet
  • Each role (eg "AUTHENTICATED USER") will now have a "SELECT ALL" button in it's column header.
  • Clicking on "SELECT ALL" will check off all the checkboxes in that column.

Screenshot

Security warning

Think twice before running bookmarklets from strangers, especially on your Drupal admin backend. Read the source carefully (it's very short in this case), and ensure you have a recent backup of the database first.

jQuery('#permissions tr th.checkbox').each(function(i){
jQuery("<button>SELECT ALL</button>").click(function() {
var columnIndex = i + 2;
jQuery('#permissions tbody tr td.checkbox:nth-child(' + columnIndex + ') input.form-checkbox').attr('checked',true);
return false;
}).appendTo(this);
});
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js" ></script>
<script src="http://dergachev.github.io/markleteer/markleteer.js"></script>
<p>To install the bookmarklet, drag the "Drupal Permissions" link to your bookmarks bar.</p>
<p><a target="_blank" href="https://gist.github.com/dergachev/5769111/raw/bbcabdae14eb09bd3e3488314e54299be8317085/installing-bookmarklet.gif">need help with this?</a></p>
<textarea class="bookmarklet" title="Drupal Permissions">
(function () {
var script = document.createElement('script');
script.src = 'https://gist.github.com/dergachev/5769111/raw/drupal-grant-all-perms.bookmarklet.js';
script.type = 'text/javascript';
document.body.appendChild(script);
})();
</textarea>
<p>Source code at <a target=="_blank" href="https://gist.github.com/dergachev/5769111">https://gist.github.com/dergachev/5769111</a></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment