Created
November 13, 2018 16:38
-
-
Save init90/74c152c79c0d977dbbaa94de9473100e to your computer and use it in GitHub Desktop.
Drupal 7, set permissions programality.
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
$perms = array( | |
// Node. | |
"create $bundle_name content", | |
"edit own $bundle_name content", | |
"edit any $bundle_name content", | |
"delete own $bundle_name content", | |
"delete any $bundle_name content", | |
// Commerce. | |
"create commerce_product entities of bundle $bundle_name", | |
"edit own commerce_product entities of bundle $bundle_name", | |
"edit any commerce_product entity of bundle $bundle_name", | |
"view own commerce_product entities of bundle $bundle_name", | |
"view any commerce_product entity of bundle $bundle_name", | |
); | |
$manager_rids = array( | |
'manager' => 4, | |
'store_manager' => 7, | |
); | |
foreach ($manager_rids as $rid) { | |
user_role_grant_permissions($rid, $perms); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment