Skip to content

Commit

Permalink
Added a commented out bit of code for automatic permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
hoegrammer committed Oct 26, 2018
1 parent 142c22f commit acf3e70
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions modules/opencase_defaults/opencase_defaults.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@
*/

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;

/**
* When a new actor type is created, this gives the CRM Admin and Overseer roles permission
* to view, edit and delete them.
*/
#function opencase_defaults_entity_insert(Drupal\Core\Entity\EntityInterface $entity) {
# if (get_class($entity) == 'Drupal\opencase_entities\Entity\OCActorType') {
# $type = $entity->id();
# $roles = Role::loadMultiple(['opencase_admin', 'overseer']);
# foreach ($roles as $role) {
# $role->grantPermission("view published $type entities");
# $role->grantPermission("edit $type entities");
# $role->grantPermission("delete $type entities");
# $role->grantPermission("add new $type entities");
# }
# \Drupal::logger('foo')->notice("<pre>".print_r(user_role_permissions(['overseer']), true) . "</pre>");
# }
#}

/**
* Implements hook_help().
Expand Down

0 comments on commit acf3e70

Please sign in to comment.