Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DanLaufer/2994d976f9cd70057424e658666a0311 to your computer and use it in GitHub Desktop.
Save DanLaufer/2994d976f9cd70057424e658666a0311 to your computer and use it in GitHub Desktop.
Bash - Drupal 8 - Script to add permissions for a role to a paragraph
#!/usr/bin/env bash
# drushpap - drush paragraph-add-permission
# usage: ./scripts/drushpap <paragraph_machine_name>
# to view the list of current permissions and roles, type: lando drush role:list
if [ "$1" = "" ]; then
echo "Error: incorrect number of arguments."
echo " - The drushpap command takes 1 argument: the machine name of the paragraph. It then gives permission to authenticated users for create, delete, update, and view, and for anonymous users to view only."
echo " - For example: drushpap my_paragraph"
else
lando drush rap authenticated "create paragraph content $1,delete paragraph content $1,update paragraph content $1,view paragraph content $1"
lando drush rap anonymous "view paragraph content $1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment