Created
October 19, 2018 17:43
-
-
Save DanLaufer/d0942d54d8f00f43fdf12d0b35635e49 to your computer and use it in GitHub Desktop.
Bash - Drupal 8 - Script to add permissions for a role to a node
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
#!/usr/bin/env bash | |
# drushnap - drush node-add-permissions | |
# usage: ./scripts/drushnap <role_machine_name> <node_machine_name> | |
# to view the list of current permissions and roles, type: lando drush role:list | |
if [ "$1" = "" ] || [ "$2" == "" ]; then | |
echo "Error: incorrect number of arguments." | |
echo " - The drushnap command takes 2 arguments: the machine name of the role and the machine name of the node. It then gives permission to that role for create, delete any, delete own, edit any, edit own, delete revisions, revert revisions, view revisions, and translate for that node." | |
echo " - For example: drushnap authenticated next_steps_cta" | |
else | |
lando drush rap $1 "create $2 content,delete any $2 content,delete own $2 content,edit any $2 content,edit own $2 content,delete $2 revisions,revert $2 revisions,view $2 revisions,translate $2 node" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment