flaglist-flaglistspermissionshandler.patch 1.3 KB

123456789101112131415161718192021222324
  1. diff --git a/src/Permissions/FlagListsPermissionHandler.php b/src/Permissions/FlagListsPermissionHandler.php
  2. index 3d08b98..baab066 100644
  3. --- a/src/Permissions/FlagListsPermissionHandler.php
  4. +++ b/src/Permissions/FlagListsPermissionHandler.php
  5. @@ -49,10 +49,15 @@ class FlagListsPermissionHandler extends PermissionHandler {
  6. // due to the flag lists module.
  7. $flagLists = $this->flagListsService->getAllFlaggingCollections();
  8. foreach ($flagLists as $flagList) {
  9. - $flag = 'flag ' . $flagList->getRelatedFlag()->id();
  10. - $unflag = 'unflag ' . $flagList->getRelatedFlag()->id();
  11. - unset($all_permissions[$flag]);
  12. - unset($all_permissions[$unflag]);
  13. + if ($flagList->getRelatedFlag()) {
  14. + $flag = 'flag ' . $flagList->getRelatedFlag()->id();
  15. + $unflag = 'unflag ' . $flagList->getRelatedFlag()->id();
  16. + unset($all_permissions[$flag]);
  17. + unset($all_permissions[$unflag]);
  18. + } else {
  19. + $logger = \Drupal::logger('flag_lists');
  20. + $logger->error('flagging_collection ' . $flagList->getName() . ' (' . $flagList->id() . ')' . ' owned by user id ' . $flagList->getOwner()->id() . ' doesn\'t have related flag');
  21. + }
  22. }
  23. // Check for access for the used template as well.
  24. $flagTemplates = $this->flagListsService->getAllFlagForList();